Advertisement

file io question pretty simple

Started by November 08, 2000 04:16 PM
3 comments, last by omegasyphon 24 years, 2 months ago
ok my problem is i have a file with data stored like this: 20 200 2 30 300 3 40 400 4 \n ok it writes user input to a file and starts a newline after the last value is entered. now on that last line when i enter the 4 and it starts row 4 i quit the program. the file has 3 rows plus the start of row 4 but its empty. when i go to read in the file and display the data it displays the last row of data twice becuase of the \n that was from the 4. how can i end the file output so that there is no new line started after the third row of data is entered?
You''re probably just checking for a feof(), but you need to check the return value of the read function as well.

You didn''t state how you were reading, so I''m guessing
Advertisement
yes im using fin and eof but how do i check for return value?/
http://www.eskimo.com/~scs/C-faq/q12.2.html
your link is broken

This topic is closed to new replies.

Advertisement