   FILE IO
  HiyaI''m doing AI for a sidescrolling yoshi''s island type ascii game and I''d like to store my information in external text files (just like 20 variables per AI type).  I have the basic AI class done, but need a good way to read it in.  I''ve been using fscanf for a while but have enountered some problems with formatting.  What kind of file structure and functions do you guys usually use for file IO?  Any suggestions?  Basically I''d like to move away from fscanf if there''s something easier/more powerful.Thanks!Ben 
  Maybe XML with TinyXml? ;  I''m doing this in C++... I need something a beginner-intermediate can handle that supports text IO ;  Might be better if you told us your formatting problems as i use fscanf religiously to load maps etc and never have a problem?well lie, i did at the start until i sussed itlet me know ;   You could store it in structs! I made that one time and it is very simple because you get all the parameters you need in just one read! It may use more resources that you''ll need, but it''s much easier to handle... ;  Using structures could make life easier as you can write the struct out to a binary file to prevent other people from messing with your settings. I've found the C I/O functions to be easier to use if im using binsry files but the C++ I/O streams are capable of reading/writing binary files also.This is one way that you can do it (with C style I/O)struct AIType {    //your vars}g_AIType;//set the struct vars etc//write the data out to a fileFILE *g_pFile = fopen("SomeFile", "wb");fwrite(&g_AIType, sizeof(AIType), 1, g_pFile);fclose(g_pFile);//then to read the data back ing_pFile = fopen("SomeFile", "rb");fread(&g_AIType, sizeof(AIType), 1, g_pFile);   [edited by - Spudder on February 6, 2004 7:33:47 AM]