Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pacbell!hoptoad!gnu From: gnu@hoptoad.uucp (John Gilmore) Newsgroups: comp.lang.c Subject: Re: Binary I/O on stdin/stdout? Message-ID: <4296@hoptoad.uucp> Date: 1 Apr 88 14:15:29 GMT References: <302@goofy.megatest.UUCP> <225800017@uxe.cso.uiuc.edu> <3221@haddock.ISC.COM> Organization: Grasshopper Group in San Francisco Lines: 42 karl@haddock.ISC.COM (Karl Heuer) wrote: > In article <8036@elsie.UUCP> ado@elsie.UUCP (Arthur David Olson) writes: > >> > There seems to be *no way* to "reopen" these streams as binary. > >> There was a proposal for freopen((char*)0,mode,stream) to effect > >> a change of mode on an open stream, but several implementors > >> thought that switching modes in midstream could be difficult to > >> support on some systems. > Let's consider three classes of machines. Those on which text and binary > streams are identical (POSIX); those on which such a mode-change is impossible > (probably because the mode is set in concrete when the file is first opened); > and those on which it is neither trivial nor impossible. > The proposed functionality is only useful on the third class. Are there any > such implementations? (Where do MSDOS and VMS fall?) Let me give you a specific example to chew on. I have written a bunch of programs for manipulation of image files in the Sun rasterfile format. The particular format is not important to know except that it is binary. Now, these programs are set up to accept a rasterfile on stdin, manipulate it, and produce a new one on stdout, so you can do things like: