By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,309 Members | 1,452 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,309 IT Pros & Developers. It's quick & easy.

Convert String* to char*

P: n/a
Hi,
I have a managed C++ app in which i need to convert String * to char *.
How can i achive this?.
regards
-sarab
Nov 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
There's a useful article about it:
http://support.microsoft.com/?kbid=311259

Tom

sarab wrote:
Hi,
I have a managed C++ app in which i need to convert String * to char *.
How can i achive this?.
regards
-sarab

Nov 17 '05 #2

P: n/a
sarab wrote:
Hi,
I have a managed C++ app in which i need to convert String * to
char *. How can i achive this?.


See System.String.PtrToStringChars() to get a wchar_t __pin*. You can then
use wcstombs() or WideCharToMultiByte() to convert that wide-character
string to a narrow-character string.

-cd
Nov 17 '05 #3

P: n/a
Thanks

-sarab

"Tamas Demjen" wrote:
There's a useful article about it:
http://support.microsoft.com/?kbid=311259

Tom

sarab wrote:
Hi,
I have a managed C++ app in which i need to convert String * to char *.
How can i achive this?.
regards
-sarab

Nov 17 '05 #4

P: n/a
acting on CString you got LockBuffer( ) and ReleaseBuffer() too
"Carl Daniel [VC++ MVP]" wrote:
sarab wrote:
Hi,
I have a managed C++ app in which i need to convert String * to
char *. How can i achive this?.


See System.String.PtrToStringChars() to get a wchar_t __pin*. You can then
use wcstombs() or WideCharToMultiByte() to convert that wide-character
string to a narrow-character string.

-cd

Nov 17 '05 #5

P: n/a
sarab wrote:
Hi,
I have a managed C++ app in which i need to convert String * to char *.
How can i achive this?.


This article describes several ways:

How To Convert from System::String* to Char* in Visual C++ .NET
http://support.microsoft.com/default...b;EN-US;311259

--
Doug Harrison
Microsoft MVP - Visual C++
Nov 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.