The idea here is to seek to a specific location of the file, write over the record there, thus modifying only a specific portion of the file.
When executed, the specific record is updated but all other records are erased.
This is as if the ios::trunc flag was applied to the fout stream. Is it ON by default? Is there any way to make it work like it is supposed to? writing over just the required record? I have been updating files by writing to another temp file, deleting the old and renaming the new but is there a better way?
Really ?! No Ideas? I couldn't find any documentation about this issue with using file streams. If this were the case, I see no point of having the put pointer, seekp() etc.
I tried that. But it allows addition only at the end of the file. What I am trying to do is to write over a record in the file so as to modify it, leaving the rest of the file intact. When ios::app flag applied, irrespective of where I point the put pointer to using seekp(), the writing takes place at the end of the file.