Paul Herring wrote:
> On Tue, Aug 5, 2008 at 5:42 PM, mano M <[EMAIL PROTECTED]> wrote:
>> How can we replace with same length of line. After reading one line , 
>> decided to replace
>> it with same length, But this time file pointer is on the next line .
> 
> Save the  pointer before you change it. Pseudocode:
> 
> size_t old_pos = filepos(fp);
> // write data.
> seek(fp, old_pos);
> 
> You're back to where you started, but with an updated file.

Shouldn't that be:

size_t old_pos = filepos(fp);
// read line.
seek(fp, old_pos);
// write line of same length.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to