Jump to content
  • Advertisement

Archived

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

_SKOTTIE_

quick problem with file input

This topic is 5455 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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)
Data/lvl1back.sdf
 50 
 1 
Data/enemy1.sdf
 1 
 5000 
 200 
-200 
 0 
 75 
 100 
[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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!