467,926 Members | 1,744 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,926 developers. It's quick & easy.

Convert String* to char*

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
  • viewed: 4038
Share:
5 Replies
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
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
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
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
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.

Similar topics

5 posts views Thread by IamZadok | last post: by
7 posts views Thread by MilanB | last post: by
15 posts views Thread by Yifan | last post: by
12 posts views Thread by Brian Henry | last post: by
2 posts views Thread by Steve Kershaw | last post: by
5 posts views Thread by Zytan | last post: by
12 posts views Thread by Peter | last post: by
14 posts views Thread by rtillmore | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.