Jump to content
  • Advertisement

Archived

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

knealeaj

Counting chars from a file!!

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

Hi guys! I am writing a break out clone in c++. I want to read in a text file full of characters to implement the positioning of the blocks. How do I count the number of characters in the file. Thanks

Share this post


Link to post
Share on other sites
Advertisement
You could:
1) read in a character at a time and increment a counter
2) you can use the seekg member function of fstream and seek to the end of the file, then use tellg to give you your location, which will be the file size.

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!