   What functions for saving and loading?
  What C++ functions should I use to save my map data? I want to isolate all my save/load operations in a file manager object so I can switch from multiple files to one big file later with out the rest of the engine knowing. I have read an article that recommended write() and read() but then i read in another forum that those functions were not safe to use. Anyone have a better suggestion? How should i structure my file mananager?Clarification:What i have been doing is taking the structures (struct MapData, struct Tile, etc...) and using "out.write( (char*) &TheTile, sizeof(TheTile))" to put them into a file. I have however heard that variables can be of different sizes on different systems (I am not certain what is meant by this). Will this cause difficulty later? Is there a better or easier way to save this map data? What if later I wanted to stick all my maps and other data into a single file? I wanted to make FileManager class accessable through functions that acted like write and read and so that the manager would slap a header on the chunk of data and put it into a single file without the other objects knowing. Would this work?Am I forgetting anything that might cause problems later?[edited by - ReaperX on May 27, 2003 9:49:49 AM][edited by - ReaperX on May 27, 2003 9:50:36 AM]
  for C++ you should use the ofstream and ifstream for saving and loadingofstream ofs;ofs.open("File.txt");ofs<<"Writing to the file!"<ofs.close();ifstream ifs;ifs.open("File.txt");int n;ifs>>n;cout<<"Read in "<ifs.close;there you go!  ;  If you are using a binary data format for your map, you should use the read and write functions of the std::ifstream and std::ofstream, like this...#include <fstream>char Buffer[100];std::ifstream In( "<SOMEFILE>", std::ios::binary );In.read( Buffer, 99 );//and to write the buffer ...std::ofstream Out( "<SOMEFILE>", std::ios::binary );Out.write( Buffer, 99 );Of course, you can use the C library functions fopen, fread, and fwrite as well  