There are a couple of ways you can do this. One would be to have each number on it's own line separate from the bmp file name, and then call the atoi() function on lines containing numbers.
Or, you could parse the line after it is read into your program using ',' as a token. Then call atoi() on all numbers that are found.
Or you could remove the commas, and instead of reading the entire line, only read a string at a time, and only call atoi when a number is encountered.
Lot's of ways to do this.
Edit
----
Here's my open file code for my map editor
int Open_Map(char * filename, HWND hwnd){ ifstream fin(filename); char buf[80]; int i; /* figure out how many tiles this map contains */ do { fin.getline(buf,80); } while (!isdigit(buf[0])); int totalTiles = atoi(buf); /* done */ /* find the height/width of the tiles and find how many rows/columns */ do { fin.getline(buf,80); } while (!isdigit(buf[0])); TILE_WIDTH = atoi(buf); fin.getline(buf,80); TILE_HEIGHT = atoi(buf); fin.getline(buf,80); TILES_WIDE = atoi(buf); fin.getline(buf,80); TILES_HIGH = atoi(buf); /* done =) */ /* allocate enough memory to hold the tiles */ delete [] maptiles; maptiles = new MAPTILES[totalTiles]; /* done */ /* put the file pointer in the right spot */ do { fin.getline(buf,80); } while (!isdigit(buf[0])); /* done */ /* read data into the maptiles struct */ for(i = 0;i<totalTiles;i++) { maptiles.x = atoi(buf); fin.getline(buf,80); maptiles.y = atoi(buf); fin.getline(buf,80); maptiles.collisionLayerOne = atoi(buf); fin.getline(buf,80); maptiles.collisionLayerTwo = atoi(buf); fin.getline(buf,80); maptiles.animLayerOne = atoi(buf); fin.getline(buf,80); maptiles.animLayerTwo = atoi(buf); fin.getline(buf,80); maptiles.layerone = buf; fin.getline(buf,80); maptiles.layertwo = buf; // get to the next tile by skipping two lines fin.getline(buf,80); fin.getline(buf,80); } fin.close(); RedrawWindow(hwnd,NULL,NULL,RDW_UPDATENOW); Draw_Map(hwnd); return 0;}
as you can see, I've decided to have each number on it's own line, and then I call atoi on lines containing numbers.