I'm with tneva82 with regards to using C/C++ standard functions. However, I prefer not to rely on saving things in text format, especially if it means revealing binary data to someone who might modify the information. True that for simple things it would be easy to find and modify binary data. But if the information is sufficiently complex it would deter the casual hacker.
Typically I'd do something like:
typedef struct _myData {
int id;
char name [20];
} MYDATA;
MYDATA record;
record.id = 1;
strcpy (record.name, "some name");
I'm a bit rusty on fstream so bear with me on this next part.
fstream myFile;
myFile.open ("data.bin", fstream::binary | fstream::out);
myFile.write (&record, sizeof(record));
myFile.close();
And, of course, reversing it for reading. The advantage is that you can write out whole lumps of data in one operation, including writing out an array of such structures that might define levels or identify objects.
Lilith, Night Butterfly
I'm not a programmer but I play one in the office