• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

C++ reading file

GiLtY

Golden Member
I'm quite new to C++ still, so please help me 😱 :
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😱!

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
 
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.
 
Back
Top