473,549 Members | 3,127 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4326
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.P trToStringChars () to get a wchar_t __pin*. You can then
use wcstombs() or WideCharToMulti Byte() 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.P trToStringChars () to get a wchar_t __pin*. You can then
use wcstombs() or WideCharToMulti Byte() 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
51664
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 have some legcay C code that needs to process a string taken from a textbox, then I need to re-display the string as the textbox->Text. I easily found...
5
6155
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
66579
by: MilanB | last post by:
Hello How to convert char to int? Thanks
15
10801
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
2955
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 and not have it affected by the null? because it is right now causes truncated data at wierd places... but as soon as i manually with a hex editor...
2
2338
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: char = {0, 0, 0, 4, 5, 7}. Now I need to convert it back to a string. Thanks in advance for your help. Steve
5
38513
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 to string. I have a function that accepts a string, and I wish to access this function for each character in the string, individually. The only...
4
17329
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
13515
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} System.Text.UTF8Encoding str = new System.Text.UTF8Encoding(); string s = new string((char)107, 1); s += new string((char)62, 1);
14
13452
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. This is what I have so far: #include <stdio.h> #include <stdlib.h> #include <string.h>
0
7718
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7809
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.