Fstream and structs conflict?

closed account (4iwkoG1T)
I'm trying to read in strings and integers into separate arrays using structs but it's not working right
I have a file with 3 name and 3 ids.
Ex: James 34
Sandy 54
Mark 55
Last edited on
while(fin.good() )

Looks like you're incrementing your counter before the code has executed once. Try putting ++count (++count is better than count++) at the END of the while loop statements.
(++count is better than count++)

++FOO increments FOO and returns FOO.
FOO++ increments FOO and returns what FOO was before it was incremented.

I have run into situations where I would use FOO++ instead of ++FOO.

But I do agree with your suggestion.
Topic archived. No new replies allowed.