fseek()
Hey guys.
I saw that if you use: fseek(fp, 0, SEEK_END) It find you the beginning of the last line in a file. Does it mean the last EMPTY line? or the last line like this: if I have a file and it looks like this Code:
Counter-Strike 1.6 is oldCode:
Counter-Strike 1.6 is oldHow can I use fseek to write a new line at the end of the file with fputs? (except of course with using many fgets while !feof, cuz fgets moves the pointer automatically) |
Re: fseek()
To append new contents, just open the file with : fopen and "a" flag.
|
Re: fseek()
then if I use fputs it will just add a new line?
|
Re: fseek()
"a+" Open a file for reading and appending. All writing operations are performed at the end of the file, protecting the previous content to be overwritten. You can reposition (fseek, rewind) the internal pointer to anywhere in the file for reading, but writing operations will move it back to the end of file. The file is created if it does not exist.
nvm i guess it will. |
| All times are GMT -4. The time now is 08:26. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.