Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 3.5 and Visual Studio. 2008 > Visual Studio 2008
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Studio 2008 For discussing Visual Studio 2008. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2008 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 11th, 2011, 05:28 PM
Registered User
Join Date: Feb 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default managed mem char array to string


struct ToFromPcStruct
unsigned long m_dwKeyValue;
unsigned char m_bAction;
ConfigRecord m_cf;

struct ConfigRecord
unsigned long m_Len; // length of record
... unsigned char m_FileName[80];.
unsigned short checksum; };

and this code:

ToFromPcStruct* tfpc = new ToFromPcStruct;
Marshal::Copy(bytesReceived, 0, System::IntPtr(tfpc), sizeof(ToFromPcStruct));
tempStr = System::Text::Encoding::ASCII->GetString(bytesReceived)->Substring(sizeof(ToFromPcStruct));
array<String^>^split = tempStr->Split(0);
tempStr = split[0];

Why can I not simply write
tempStr += tfpc->m_cf.m_FileName;


Last edited by rrnut; February 11th, 2011 at 05:30 PM..
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Strings (differences between an array of char and *char) gabberfrombcn C++ Programming 2 August 30th, 2010 08:02 PM
Basic char array and cin query. gillianbc C++ Programming 4 November 4th, 2004 07:44 PM
Char array cin query (additional) gillianbc C++ Programming 3 October 29th, 2004 03:22 PM
Converting from managed String to MFC CString neethling Visual C++ 0 October 28th, 2004 10:20 AM

All times are GMT -4. The time now is 07:23 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.