DVItoPS on DECstation

Michael Meissner meissner at osf.org
Tue Oct 16 01:19:50 AEST 1990


In article <1990Oct13.204721.8027 at maths.tcd.ie> tim at maths.tcd.ie
(Timothy Murphy) writes:

| I was recently compiling the TeX PostScript driver program dvitops
| on a DECstation,
| and was surprised to find that the compiler didn't like
| 	fopen(filename, "rb");
| It didn't object at compile-time,
| but simply failed to open the file (returning NULL).
| (There was no problem once all the "rb"'s and "wb"'s
| were changed to "r" and "w".)
| 
| I think it's quite a common practice to give the "rb" and "wb"
| arguments for Unix/DOS compatibility.
| Is this relying on the compiler's generosity?

Actually it relies on the normal UNIX library not fully checking the
string passed to fopen.  Ultrix evidently does more stringent
checking.

| What does standard C say about it?

The new options "rb", "wb", and "ab", etc. are required to be
supported by anything that claims to be ANSI conformant.  However,
DEC doesn't currently claim ANSI conformance.....

| And should the DECstation compiler have complained at compile-time,
| if it didn't understand the argument?

Few C compilers know about the precise arguments to fopen.  In
general, fopen is just another function (remember I/O is not built
into the language, but is provided by the library -- C is not PASCAL
or PL/1).  If you have a fopen prototype, then the compiler would know
that the second argument to fopen is a char *.
--
Michael Meissner	email: meissner at osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142

Do apple growers tell their kids money doesn't grow on bushes?



More information about the Comp.std.c mailing list