473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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
5 4317
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Trep | last post by:
Hi there! I've been having a lot of difficult trying to figure out a way to convert a terminated char array to a system::string for use in Visual C++ .NET 2003. This is necessary because I...
5
by: IamZadok | last post by:
Hi I was wondering if anyone knew how to convert a string or an integer into a Static Char. Thx
7
by: MilanB | last post by:
Hello How to convert char to int? Thanks
15
by: Yifan | last post by:
Hi Does anybody know how to convert System::String* to char*? I searched the System::String class members and did not find any. Thanks Yifan
12
by: Brian Henry | last post by:
first question... I have a flat file which unfortinuatly has columns seperated by nulls instead of spaces (a higher up company created it this way for us) is there anyway to do a readline with this...
2
by: Steve Kershaw | last post by:
I can convert from a string to a char array (char) by using string.ToCharArray() function. Now how do I convert it back? The string looks like this: "000457". I've converted it to a char array:...
5
by: Zytan | last post by:
I am surprised that a single character string is not auto-created from a single char. It is hard to find information on converting a char into a string, since most people ask how to convert char...
4
by: Man4ish | last post by:
HI , I am trying to convert string into char array of characters.but facing problem. #include <iostream> #include <string> using namespace std; int main() { string t="1,2,3,4,5,6";
12
by: Peter | last post by:
Trying to convert string to byte array. the following code returns byte array of {107, 62, 194, 139, 64} how can I convert this string to a byte array of {107, 62, 139, 65} ...
14
by: rtillmore | last post by:
Hello, I did a quick google search and nothing that was returned is quite what I am looking for. I have a 200 character hexadecimal string that I need to convert into a 100 character string. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.