About | Blog | Publications | Projects | Resume | Contact

Follow Me

AddThis Feed Button
Subscribe to me on FriendFeed

 

Currently Reading

Tuesday, January 11, 2005

Converting .NET Managed String Objects to NULL Terminated Char Pointers in C++

This is something that took me a long time to get figured out, and I'm still not sure if I am correctly transfering the data from the managed string object into the NULL terminating char pointer:

1#pragma managed
2char* TranslateRealStringToCharPtr(System::String* strToConvert)
3{
4	System::String* StringPointer = strToConvert;
5	char* CharPointer = _
6	  (char*)(void*)Marshal::StringToHGlobalAnsi(StringPointer);
7	return CharPointer;
8}
 

I think that there is a memory leak in the code, but I can't figure out where it is. Any ideas?

posted by Chip Childers @ 8:00 AM   0 comments
Links to this post

Links to this post:

Create a Link

0 Comments:

Post a Comment

<< Home

 

© 2005, Jerry W Childers, Jr. - This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 2.5 License.
Creative Commons License