DHOLLINGSWORTH2 said:
You can open a file to "rw", which will allow you to make changes. However, if you are inserting text, then the portion of the
file occuring after the change would be over written. AS long as you are replacing say a char with a different char this is ok.
Otherwise you will need to read ahead of your write, and re-write the intire end of the file.
That suggestion should be followed with some
caution and a caveat. For characters that are
not subject to line-boundary translations, it
will work. But if the stream is opened in text
mode, (usually the default), be aware that for
each such character written, more than one
byte could be written and that for each such
character overwritten with a plain character,
the result could be the plain character value
followed by a portion of the line-boundary
sequence used on the system.
For those reasons, I would tend to not try
to exploit the suggestion.