Path: utzoo!mnetor!uunet!husc6!mailrus!nrl-cmf!ames!amdahl!dlb!megatest!djones From: djones@megatest.UUCP (Dave Jones) Newsgroups: comp.lang.c Subject: Re: Binary I/O on stdin/stdout? Message-ID: <414@goofy.megatest.UUCP> Date: 28 Mar 88 22:02:52 GMT References: <4250@hoptoad.uucp> Organization: Megatest Corporation, San Jose, Ca Lines: 17 in article <4250@hoptoad.uucp>, gnu@hoptoad.uucp (John Gilmore) says: > > I was just reading over the standard trying to figure out the differences > between binary and text files and had a few realizations: > > * Stdin, stdout, and stderr are assumed to be *text* files. > A program that does binary I/O on them is not portable. So, how does > one fix this? > > ... On a Unix system, one writes a buffering package for raw bytes, something akin to stdio, using write(). Since you don't need printf and scanf, it's no big deal. Unfortunately, I have seen one implementation of C (IBM System 370) which does not have write(). Or if they do, they don't document it.