|
Posted by Michael Fesser on 11/01/07 05:24
..oO(Steve)
>"Good Man" <heyho@letsgo.com> wrote in message
>news:Xns99DA9F95284D5sonicyouth@216.196.97.131...
>> Pupkin <spamagnet@dorrk.com> wrote in news:MPG.21926fd8833b9cbb9897e5
>> @news.giganews.com:
>>
>>> If I'm using fwrite to append text to a file, is it possible to set the
>>> pointer to a specific line # at which to insert the text, rather than
>>> the beginning or end of the file?
>>
>> the easiest way would be something along the lines of:
>>
>> 1) fread your source file into a variable
>> 2) fopen a new file for writing
>> 3) go through your source file line-by-line using a loop
>> 4) for each line you read, fwrite it to your new file (keeping an eye out
>> for the line number you want to change... when you find it, change it and
>> write it to your new file)
>> 5) close the files
>
>which is about the most un-informed and stupid suggestion from you this
>week - i have to quantify/qualify that remark since you are wont to such
>inanity.
>
>both the op AND you should RTFM !!!
Ever tried to use fseek() to insert data into a file?
Micha
Navigation:
[Reply to this message]
|