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

Can I remove bytes from a (o)fstream object?

0 views
Skip to first unread message

Jantje Smit

unread,
Jul 6, 2002, 1:38:57 PM7/6/02
to
I was wondering how to remove bytes from a binary file, if
possible. I looked up the member functions of fstream (and
ofstream), and no functions are provided to remove bytes
from the stream (AFAIK).

Does this mean, the only way to remove a part of a file, is
to rewrite the file to disk, but without the removed part?!?
(I could do that, but I just wrote an insertion function,
which allows me to insert bytes in a file stream without
having to close and reopen the file stream, and would like
to have such an option for deletion as well)

Can anyone enlighten me on this?

Many thanks,
Dede

Nithyanandham M

unread,
Jul 6, 2002, 3:43:46 PM7/6/02
to

Jantje Smit wrote:

C++ doesn't have a provision to delete 'N' bytes directly from a file
without copying the file contents appropriately.

Your OS may have a solution for the same.

--

Nithyanand.
Siemens, Bangalore, India.
(Opinions expressed are my own and do not reflect the opinions of my
employer, SIEMENS)

0 new messages