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

CreateTextFile vs. OpenAsTextStream

369 views
Skip to first unread message

tsg

unread,
Jun 3, 2001, 11:50:48 PM6/3/01
to
I am wondering what the differences are from CreateTextFile method and
OpenAsTextStream. I am wanting to write data to an existing file,
overwriting the existing data. I can do this with both of these methods but
am wondering if one has some advantage over the other.


Tim


Tom Lavedas

unread,
Jun 4, 2001, 2:28:17 PM6/4/01
to
The only difference I can discern is in readability for maintenance
purposes. If the file is not likely to exist, then CreateTextFile is
somewhat more descriptive of the actual function. It also implies write
and never read status for the file. OpenAsTextStream might be
preferable in an application where a known existing file is expected,
even when the intent is to overwrite it. Other than that, I suspect the
same Windows API is invoked when (over) writing a file (though I don't
'know' this).

Just to complicate things a bit, you can also consider the use of the
OpenTextFile method, which has additional parameter options ;o)

Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/

0 new messages