   More file reading problems
  Ok, I have an array of ints called s_Type[10] And I have the following function that reads data in from a text file: int CLevel::InitLevel(char *dir){char filename[255];// The filenamechar buffer[255];// BufferFILE * fp;// The file  sprintf(filename, "%s/leveldata", dir);// Load the filename into a string// Try to open the file  if((fp=fopen(filename, "rb")) == NULL)  {// If the file could not be opened, print an error message    printf("ERROR opening file %s\n\n", filename);    return 1;  }// Get the first line of the file to set the current levelfgets(buffer, 255, fp);sscanf(buffer, "LEVEL: %d", &m_LevelData.s_Level);while(!feof(fp))  {    fgets(buffer, 255, fp);    if(buffer[0] != '#' && buffer[0] != '\r' && buffer[0] != '\0' && buffer[0] != '\n' && strlen(buffer) != 0)    {sscanf(buffer, "NEXT LEVEL: %s",&m_LevelData.s_NextLevel);sscanf(buffer, "DISTANCE: %d",&m_LevelData.s_Distance);sscanf(buffer, "BOSS: %s %d",&m_LevelData.s_Boss, &m_LevelData.s_BossHP);sscanf(buffer, "SCENE: %s",&m_LevelData.s_Scene);sscanf(buffer, "SHIP: %s",&m_LevelData.s_Ship);sscanf(buffer, "BULLET: %s",&m_LevelData.s_Bullet);sscanf(buffer, "%s %d %d %d",&m_LevelData.s_Enemy,&m_LevelData.s_Type,&m_LevelData.s_HP,&m_LevelData.s_Speed);}}fclose(fp);return 0;}And this is my text file:LEVEL: 1# Next level is the data path of the next level - duh! NEXT LEVEL: data/level_2# Distance is how far the ship must travel until the boss is metDISTANCE: 2# Boss information goes here# SYNTAX: directory, HPBOSS: data/meteor20# Scene is pretty self explanatory# NOTE: The bitmap must be 640x480 resolution or else it will be off. This will soon be fixedSCENE: data/bg.bmp# Ship and bullet are what the ship's image and it's bullet isSHIP: data/shipBULLET: data/bullet# Enemy information here# SYNTAX: enemy type (which enemy is it), HP, Speed,data/enemy  1   3   4data/enemy  2   4   5    How can I get it so that 1 and 2 are put in seperate parts in the s_Type array?   VG-Force | Ekim Gram Productions[edited by - Ekim_Gram on March 24, 2004 11:06:29 PM]
  Parse the file line by line and if an double entry is found it just creates a new item? I would stuff it all into a vector/list.Toolmaker   -Earth is 98% full. Please delete anybody you can. ;  I tried using a vector but I ran into problems pushing it onto it.   VG-Force | Ekim Gram Productions