Binary I/O on stdin/stdout?

Doug Gwyn gwyn at brl-smoke.ARPA
Mon Apr 25 02:24:37 AEST 1988


In article <281 at quequeg.UUCP> amen at quequeg.UUCP (Bob Amen) writes:
>	Perhaps I'm a bit confused here but it's always been my impression
>that UNIX was designed to make no distinction between binary and ASCII
> ...
>Why is this a problem now?  I've
>been following this discussion but have not yet heard a compelling reason
>to break one of the greatest advantages of UNIX.

You misunderstand.  UNIX need not (and undoubtedly will not) change in
this respect.  The discussion was about what should be specified in the
forthcoming ANSI C standard, which applies across ALL operating systems,
including some that would have great difficulty supporting a UNIX-like
notion of file.  Such systems often need to treat text files and binary
files in different ways.  The "b" specifier appended to an fopen() mode
requests that the stream be handled as binary; stdin/stdout/stderr are
required to be initially open as text streams.  On UNIX it makes no
difference, but on some systems this can pose a problem.

We were careful to permit text and binary streams to be indistinguishable
on systems where that was appropriate; the forthcoming IEEE Std 1003.1
(POSIX) requires this behavior, which is compatible with proposed ANSI C.



More information about the Comp.lang.c mailing list