why no fdopen() in dpANSI C? (was Re: Binary I/O on stdin/stdout?)

Daniel R. Levy levy at ttrdc.UUCP
Mon Apr 11 10:37:38 AEST 1988


In article <8042 at elsie.UUCP>, ado at elsie.UUCP (Arthur David Olson) writes:
# > If UNIX needed this facility, and if it used "b" to indicate binary mode,
# > 	FILE *binin = fdopen(fileno(stdin), "rb");
# > 	FILE *binout= fdopen(fileno(stdout),"wb");
# > 	/* use bin_in, bin_out instead of stdin, stdout */
# > would do the job.  Would this work in MSDOS?
# 
# Whether or not it works in MSDOS, it wouldn't work in draft proposed ANSI C
# (which lacks an "fdopen" function).

Oh, GROAN.  Why not?  Sometims that's the most efficient way of getting a
stdio stream open onto a file which needs options on open() or creat() other
than the default, e.g. with permissions other than 0666&umask, or with a
special open parameter like System V's O_SYNC.
-- 
|------------Dan Levy------------|  Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
|         an Engihacker @        |  	<most AT&T machines>}!ttrdc!ttrda!levy
|     AT&T Data Systems Group    |  Disclaimer?  Huh?  What disclaimer???
|--------Skokie, Illinois--------|



More information about the Comp.lang.c mailing list