Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting from System::String * into Char *

Status
Not open for further replies.

BrimStonePhoenix

Programmer
Jun 22, 2006
7
US
I have a windows forms application, and i'm trying to read in text from 2 text boxes (which are going to contain a filename and a path), and then use sprintf to put them both into a single char[]. Any other ways of going about this problem? Any way to get this conversion to work?
 
You're going from managed to unmanaged. This is dangerous territory as it isn't guaranteed to work. In fact, MS even acknowledges that it can lock up your PC. I have seen the lockups happen a couple of times.

There is a managed equivalent of sprintf that you can use called Format.

Basically keep to all managed or all unmanaged and don't mix the two. If you do, you'll be there forever. Not only that: it is next to impossible to debug as Visual Studio keeps on locking up whenever you try debugging with both CLR and native.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top