Appending to FileStream

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Appending to FileStream

Ian Bartholomew-7
If you open up a FileStream for writing and want to append to an existing
file then

FileStream class>>write:mode:

works as expected. However, if you want to append to a _binary_ file then
you have to use one of the following, to allow you to change the text/binary
argument.

FileStream class>>write:mode:check:text:
FileStream class>>write:mode:check:type:

The problem is that this ends up truncating the file as the check for the
#append mode that is done at the end of #write:mode:, which sets the file
pointer to the end of the file, is not performed by these two methods.

Regards
    Ian