File write in C confusion?

Check for errors returned from those system calls - that code looks correct. Also, check to make sure you aren't accidentally mangling dat. Txt elsewhere in your code.

This should be ok. Check your code again, maybe you are repostioning the file pointer, with frewind or fseek somewhere. A better way is to use the "a+" option.

You should also check the return value fout from fopen.

Fseek and friends should not affect the write position of a file opened in append mode. Writes to append mode files always go to the end of file. If they don't, then the underlying C library is buggy.

– laalto Jun 25 '09 at 13:07.

If you do anything else with that file before the append, make sure you are closing it.

I compiled on Mac OS (Linux) and it works as advertised, e.g. The line was appended at the end. Are you doing something else with the file?

Check your code again, maybe you are repostioning the file pointer, with frewind or fseek somewhere. A better way is to use the "a+" option. You should also check the return value fout from fopen.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions