Reading certain numbers at a time from an int file

Hey guys. I need help reading certain int's at a time from one int number stored in a file. I'll explain. I am working on an ezpass project and basically I have to store an int in a file, and from that file, write a program that separates numbers into information.
For example:

the number 204601324 is stored in a file. I know how to open a file from terminal, but the issue is reading the individual numbers. The first number is weight class (2). My program has to display that number as the Variable "weightClass." how do I get it to do that? In addition, miles allowed is the number "0460." How do I get that number to display as the variable "oMiles?"

Thanks for any help!
http://en.cppreference.com/w/cpp/io/basic_istream/get
http://en.cppreference.com/w/cpp/io/basic_istream/read

You could use one of the above member functions to extract a certain amount of characters from the file stream.
Last edited on
Topic archived. No new replies allowed.