Hey,
How can i make Non-ASCII (Binary) Output to files using MSC++ 6's File Stream Classes??
I Hope my Question is Clear :D
Cya.
Printable View
Hey,
How can i make Non-ASCII (Binary) Output to files using MSC++ 6's File Stream Classes??
I Hope my Question is Clear :D
Cya.
I thinkCode:int n=800;
ostream out("file",ios :: binary|ios :: out)
out.write((char *) &n,sizeof n);
This Doesn't seem to work, Does somebody else know how to do this??
It should work. I had a typo before, forgot to end the declaration with a semicolon.
I'm sorry, but it doesn't work. I noticed the Semi-Colon Error Before, i fixed this before even using the Code.
Is there another way??
There are many different ways, but if you tell us what exactly "doesn't work" we could help you fix this one.
int n=800;
ofstream out;
out.open( "filename", ios::binary );
if( out.fail() ) // do something, file not opened
out.write( &n, sizeof( n ) );
out.close();
http://www.cplusplus.com/ref/iostrea...eam/write.html