TOPIC 11.2.1
Differences in Opening Files
When using a Mac, the files must be opened using the following kind of open statement. The reason is that when the ios::in mode is used, the computer expects a DOS-type file, rather that a file created on a Mac.
infile.open("TEMPS.DAT");
Also, when reading test files with programs compiled in Symantec C++, the first element in the file may be ignored.
Some Metrowerks CodeWarrior compilers for the Macintosh do not allow the ios::out stream operation mode to be used alone. When opening a file for standard output in CodeWarrior, omit the ios::out. For example, instead of
outfile.open("FLOATS.DAT", ios::out);
use
outfile.open("FLOATS.DAT");
When opening a file for appending, use both the ios::out and ios::app operation modes. For example, instead of
outfile.open("NAME_AGE.DAT", ios::app);
use
outfile.open("NAME_AGE.DAT", ios::out | ios::app);