Raised This Month: $ Target: $400
 0% 

fseek()


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 12-02-2011 , 15:03   fseek()
Reply With Quote #1

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 old
Call of Duty is newer
will it find the beginning of the line "Call of Duty is newer" or the beginning of the last line HERE?:

Code:
Counter-Strike 1.6 is old
Call of Duty is newer
// here??
The reason I want to know is, that I want everytime that something new will be added to a file. So what I want to do is fseek to a NEW LINE, then fputs something. and as far as I know if I use fputs it just erases the first line (or wherever the cursor pointer is found at) and overwrites it with the string parameter you gave.

How 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)
__________________
My Projects:

Auto-Mix (Pug): 100%

Joined the Military (a soldier now) - Inactive
Diegorkable is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode