How do you open up an output file stream so you can write data in the
middle of a file? When I open using :overwrite, it erases the file. When
I use :append it writes my data to the end of the file even when I set
the file position to a point inside the file. What am I doing wrong?
Thanks,
Scott
In article <·················@lmco.com>,
Scott Sheffield <·················@lmco.com> wrote:
> How do you open up an output file stream so you can write data in the
> middle of a file? When I open using :overwrite, it erases the file. When
> I use :append it writes my data to the end of the file even when I set
> the file position to a point inside the file. What am I doing wrong?
> Thanks,
> Scott
:direction :io
:if-exists :overwrite
Vassil Nikolov <········@poboxes.com> www.poboxes.com/vnikolov
(You may want to cc your posting to me if I _have_ to see it.)
LEGEMANVALEMFVTVTVM (Ancient Roman programmers' adage.)
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
* Scott Sheffield <·················@lmco.com>
| How do you open up an output file stream so you can write data in the
| middle of a file? When I open using :overwrite, it erases the file.
| When I use :append it writes my data to the end of the file even when I
| set the file position to a point inside the file. What am I doing wrong?
instead of trying :IF-EXISTS options, look at :DIRECTION.
incidentally, :IF-EXISTS OVERWRITE should _not_ erase the file.
#:Erik
Scott Sheffield <·················@lmco.com> writes:
> How do you open up an output file stream so you can write data in the
> middle of a file? When I open using :overwrite, it erases the file. When
> I use :append it writes my data to the end of the file even when I set
> the file position to a point inside the file. What am I doing wrong?
> Thanks,
> Scott
Try opening in :APPEND mode and moving the file position around.
(Whether it works may be implementation-dependent, since it may depend
on characteristics of the underlying file system to support. If you
read the description of :append in the definition of OPEN, I think
you'll see this is at least not too far-fetched.)