Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!genrad!decvax!cca!ima!johnl From: johnl@ima.UUCP Newsgroups: net.unix-wizards Subject: Re: fdopen(open(... vs. a plain fopen(.. - (nf) Message-ID: <350@ima.UUCP> Date: Fri, 24-Jun-83 18:37:15 EDT Article-I.D.: ima.350 Posted: Fri Jun 24 18:37:15 1983 Date-Received: Sat, 25-Jun-83 21:42:42 EDT Lines: 23 #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