This topic is now archived and is closed to further replies.


quick problem with file input

Recommended Posts

_SKOTTIE_    122
in my level script editor files... there are descriptions of each enemy so they can be identified in teh editor, but my game (in another program) does not need these descriptions, and needs to just feed it into garbage. each description is on its own line. thusly: this is a SSF file (stage script file)
[1] Green Plane
the information from Data/Enemy.sdf to [1] Green Plane is all enemy information. however [1] Green Plane is the description, when i try this (in_file is a ifstream): in_file.getline(garbage, 50); it reads the line in fine, but when i loop (with multiple enemies) to start reading the enemy information (such as the SDF file for the next enemy), it reads in that same line. it seems that getline does not push the read cursor to the next line when it gets it. how would i skip this extra line? thanks guys!

Share this post

Link to post
Share on other sites
nnurgle    122
are you using getline for the garbage and >> ops for the rest?
in that case getline won''t advance the position. if this is not the case, then just use the same get function you use to read the data, but loop it and ignore the data it gets.

you could use old style FILE input. it''s old, but it gives less stupid erros than ifstream.

Share this post

Link to post
Share on other sites