Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Easy question

3 views
Skip to first unread message

Scott Sheffield

unread,
Mar 23, 1999, 3:00:00 AM3/23/99
to
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


Vassil Nikolov

unread,
Mar 24, 1999, 3:00:00 AM3/24/99
to
In article <36F7E767...@lmco.com>,

:direction :io
:if-exists :overwrite

Vassil Nikolov <vnik...@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

Erik Naggum

unread,
Mar 24, 1999, 3:00:00 AM3/24/99
to
* Scott Sheffield <scott.y....@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

Kent M Pitman

unread,
Mar 24, 1999, 3:00:00 AM3/24/99
to
Scott Sheffield <scott.y....@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.)


0 new messages