Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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

Hello,

Given:
struct ToFromPcStruct
{
unsigned long m_dwKeyValue;
unsigned char m_bAction;
ConfigRecord m_cf;
};

and
struct ConfigRecord
{
public:
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;
???

Thanks.

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





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.