Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Conversion from System::String to bsic-sctring string

$
0
0

I have a program written in C++ with enabled /clr support so that I have access to namespace System. I need this to have access to the DateTime structure. Here is the relevant section of my code:

	ofstream INFO_Stream;
	System::DateTime rightNow = System::DateTime().Now;
	System::String^ SSS = rightNow.ToString();
	INFO_Stream.open(INFOfilename, ios::binary | ios::out);
	INFO_Stream.write(SSS, sizeof SSS);   //error
	INFO_Stream.write(INFO_Content.data(), INFO_Content.length());
	INFO_Stream.close();
INFO_Content is a <string> string, which I put there just as an example of what works just fine. The problem is the one before it, marked //error ["can't convert System::String^ to const char*"]. I'm not surprised by this, but don't know how to make the necessary correction. I would appreciate some help!


gabriel weinreich


Viewing all articles
Browse latest Browse all 15302

Trending Articles