TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Tom Torfs
from: George White
date: 1998-07-29 08:57:00
subject: fopen - specify director

Hi Tom,

You wrote to Robin Sheppard:

TT> KK> fopen("c:\\testfile", w);    /*  this will work.  */

TT> RS>    Yes, assuming w is a char pointer to a string, like
"wt" or some
TT> RS> such.      

TT>Except for the fact that "wt" is non-standard. You should
TT>use "w" instead for text files (and of course "wb" for
TT>binary files).

Why not use "wt"? It's a common language extension. The only compiler
I've got here that doesn't provide the capability to set the default
open mode to binary rather than text is the IBM Visualage C++, so always
specifying the open type in fopen() is not (imho) a bad thing.

Borland (3.1 and BCOS2 1.0), MS (5.1, 6.0), TopSpeed and Watcom (11)
all use the global variable _fmode to set default open mode, and default
it to text mode.

George

 * SLMR 2.1a * Computers eliminate spare time.

--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-717904) (2:440/4)
SEEN-BY: 396/1 622/419 632/371 633/260 267 270 371 634/397 635/506 728
SEEN-BY: 639/252 670/213 218
@PATH: 440/4 255/1 252/356 140/1 270/101 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.