Path: utzoo!utgpu!water!watmath!clyde!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Binary I/O on stdin/stdout? Message-ID: <3221@haddock.ISC.COM> Date: 29 Mar 88 21:42:12 GMT References: <302@goofy.megatest.UUCP> <225800017@uxe.cso.uiuc.edu> <7565@brl-smoke.ARPA> <8036@elsie.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 21 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. > >Couldn't freopen simply return ((FILE *) 0) in such cases, much as >localtime is allowed to return -1 if local time can't be determined? That's time(), not localtime(). 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?) Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint