fdopen(open(... vs. a plain fopen(.. - (nf)
johnl at ima.UUCP
johnl at ima.UUCP
Sat Jun 25 08:37:15 AEST 1983
#R:sri-arpa:-217100:ima:20400008:000:880
ima!johnl Jun 24 14:58:00 1983
As far as I can tell, there are a few situations where you might want to
do an fdopen() call on an open file descriptor.
1. When you want to open a pipe, and popen() isn't quite right.
2. When, due to some local convention, you have a file passed
already open on, say, fd 3 and you want to use that file.
3. When you want to open a tty file for read and write, and use
separate stdio FILEs for reading and writing (to avoid the
flushing and other funniness when you open something "r+".)
4. When, under Sys III at least, you want to use open flags such
as NOWAIT, you have to do the open yourself and then fdopen.
You don't need fdopen just to do an ioctl() or fstat() call, since the
macro "fileno(iop)" gets you the file number of an open FILE.
John Levine, decvax!yale-co!jrl, ucbvax!cbosgd!ima!johnl,
{research|allegra|floyd|amd70}!ima!johnl
More information about the Comp.unix.wizards
mailing list