C++ reading file

GiLtY

Golden Member
Sep 10, 2000
1,487
1
0
I'm quite new to C++ still, so please help me :eek: :
Im using fstream to read a file with three numbers "1" "23" and "34", between each number there's a space. I use two int variable to read those integers, but somehow it reads more than three numbers. And the white space doesn't do anything to the reading of the file, so i suspect that the problem is at the end of the file, but i can't figure why there's a problem since i have nothing there. Please help me:eek:!

ps. fot those particular numbers, my program reads: 1 23 34 and 23, i dont know where that 23 came from, is there anyway to get rid of 23? thx for any suggestions
 

BFG10K

Lifer
Aug 14, 2000
22,709
3,003
126
Are you using standard streams (>>) to read the file? If you are they will miss the whitespace (ie spaces).

I really need to see your code before I can help you.