Can anyone tell me if there is a fucntion or something that can read a line of integers, like getline reads characters?
Thanks
Can anyone tell me if there is a fucntion or something that can read a line of integers, like getline reads characters?
Thanks
nope. Could read the following as a string with getline() and then parse by space and change resultant substrings to int using atoi():
1234 5678 12378 765 1 0 9735
If the above constituted values of data members in a struct/class and they were in a binary file, then you could use read() method to read them into the struct/class fields all at once. If, however, you wish to store them in separate unrelated variables, then you are best advised to use >> and read them out one at a time.