Jump to content
  • Advertisement


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


ifstream integers

This topic is 6097 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

ifstream considers two integers on the same lime separate integers as long as there is whitesapce in-between them. So if the file looks like this:

18 32 36 14 95

You can just read it like this:

std::ifstream file;

int num[5];
file >> num[0] >> num[1] >> num[2] >> num[3] >> num[4];

you could just as easily do:

file >> num[0];
file >> num[1];
file >> num[2];
file >> num[3];
file >> num[4];

No, HTML is not an OO language.

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!