How do I do numeric file output?

Started by
2 comments, last by QBRADQ 22 years, 7 months ago
ofstream.write() does not suport numeric output! Good God, what the heck do I have to do to print a dang number to a file!? Edited by - felisandria on September 8, 2001 2:56:35 AM
Tell him about the twinky...
Advertisement
int i = 500;
ofstream outFile("file.txt", ios::out);
outFile << i;


~~~~~~~~~~
Martee
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
Read my post below When using an ofstream like that, even in binary mode, the numbers are formatted into text. I want just the raw data, two bytes of unsigned int

Anyhoo, typecasting got the job done, and the data file is well intact and usable. I LOVE TYPECAST! Yet it can be VERY bad when abused!
Tell him about the twinky...
Hey, my code will print a number to a file. You should've specified that you wanted raw data

~~~~~~~~~~
Martee

Edited by - Martee on September 7, 2001 12:50:15 AM
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers

This topic is closed to new replies.

Advertisement