simply write them to a file via the iostream classes.
Code:
ofstream out_file;
out_file.open("this.txt");
out_file << szText << x; //there's undoubtedly a much better way to do this
out_file.close();
you might want to give some thought to how you're going to organize the file. i recommend writing small functions to keep track of every byte spent, so that only 4 bytes are dedicated to an integer, 8 to a double, and everything until a zero for a string. you might also want to put some characters marking the data type before you load it. opening looks like this:
Code:
ifstream in_file;
in_file.open("this.txt");
in_file >> variable1 >> variable2; //unrealistic
in_file.close();
if you want to skip right over any kind of security and optimizing, just put a newline between variables and load like so:
Code:
ofstream out_file;
out_file.open("this.txt");
int x; float y; char *z; //z might need to be initialized beforehand
strcpy (z,"a cleverly worded message");
out_file << x << endl << y << endl << z << endl;
out_file.close();
....
ifstream in_file("this.txt");
in_file >> x >> y;
in_file.getline(z); //this could be wrong... check syntax to be sure
in_file.close();