Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #9459
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Ian Collins <ian-news@hotmail.com> |
| Newsgroups | comp.lang.c++ |
| Subject | Re: Create an istream from an fd? |
| Date | Tue, 30 Aug 2011 15:51:58 +1200 |
| Lines | 35 |
| Message-ID | <9c3534Fo17U1@mid.individual.net> (permalink) |
| References | <27743f07-a009-4f80-aa2f-5ab9dd9fdd9a@19g2000vbv.googlegroups.com> <j39a3q$6gk$1@dont-email.me> <9bqok6FeijU2@mid.individual.net> <j39ep8$tv5$1@dont-email.me> <9btaq6FopsU5@mid.individual.net> <2be71f2e-9a18-42ab-a7ec-bc7f8ccb215e@i9g2000yqk.googlegroups.com> <pan.2011.08.28.03.31.29.633000@nowhere.com> <3173046d-6a90-4c8d-96ab-4f0b66a85104@n12g2000yqh.googlegroups.com> <pan.2011.08.29.19.12.39.670000@nowhere.com> <9c28piFq7jU1@mid.individual.net> <pan.2011.08.30.03.40.17.243000@nowhere.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net iPyVjE3X+Mc4454UN4tQWgCptTb6NJoJNkO/fuvVUGF8JdP5b4 |
| Cancel-Lock | sha1:sN8qW7BtfTFVCez/WJT6a3osmQI= |
| User-Agent | Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.9) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.4 |
| In-Reply-To | <pan.2011.08.30.03.40.17.243000@nowhere.com> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.c++:9459 |
Show key headers only | View raw
On 08/30/11 03:40 PM, Nobody wrote: > On Tue, 30 Aug 2011 07:49:06 +1200, Ian Collins wrote: > >>> Sure, the programmer can implement something themselves. But given how >>> many programs will end up needing this (how many C++ programs use >>> third-party libraries which use FILE*?), it seems like an oversight. >> >> A lot less than those that use a file descriptor. Certainly in the Unix >> world, FILE* is seldom used and integer file descriptors are pretty much >> universal. > > That isn't my experience. Both are common enough that I couldn't say which > of the two is the more popular. Descriptors tend to be used where > buffering is likely to get in the way (e.g. binary I/O), FILE* where > it's likely to be useful (e.g. text I/O). System calls use descriptors. > Libraries which aim to be cross-platform tend to use FILE*. Descriptors are used where the 'file' isn't a regular file (or in the case of popen, a pipe). A FILE* isn't much use for a socket or a door for instance. > An odd case is that popen() uses FILE*; possibly because programs are more > likely to read/write text than binary via stdin/stdout, and that's easier > to do with buffered streams. > > Ultimately, it doesn't make a great deal of difference, given the > availability of fdopen() and fileno(). One exception is that some > platforms support "user" streams which aren't backed by a descriptor > (fopencookie() in GNU, funopen() in BSD), so working with FILE* is > slightly more general. For streams which read/write a regular file. -- Ian Collins
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Create an istream from an fd? Noah Roberts <roberts.noah@gmail.com> - 2011-08-26 08:54 -0700
Re: Create an istream from an fd? Leigh Johnston <leigh@i42.co.uk> - 2011-08-26 17:05 +0100
Re: Create an istream from an fd? Victor Bazarov <v.bazarov@comcast.invalid> - 2011-08-26 12:20 -0400
Re: Create an istream from an fd? Vaclav Zeman <vzeman79@sh.cvut.cz> - 2011-08-26 18:34 +0200
Re: Create an istream from an fd? Ian Collins <ian-news@hotmail.com> - 2011-08-27 08:48 +1200
Re: Create an istream from an fd? "Alf P. Steinbach" <alf.p.steinbach:usenet@gmail.com> - 2011-08-27 01:26 +0200
Re: Create an istream from an fd? Ian Collins <ian-news@hotmail.com> - 2011-08-27 11:30 +1200
Re: Create an istream from an fd? "Alf P. Steinbach" <alf.p.steinbach:usenet@gmail.com> - 2011-08-27 02:46 +0200
Re: Create an istream from an fd? Ian Collins <ian-news@hotmail.com> - 2011-08-28 10:52 +1200
Re: Create an istream from an fd? James Kanze <james.kanze@gmail.com> - 2011-08-27 16:35 -0700
Re: Create an istream from an fd? Nobody <nobody@nowhere.com> - 2011-08-28 04:31 +0100
Re: Create an istream from an fd? Ian Collins <ian-news@hotmail.com> - 2011-08-28 15:56 +1200
Re: Create an istream from an fd? Nobody <nobody@nowhere.com> - 2011-08-28 20:03 +0100
Re: Create an istream from an fd? Ian Collins <ian-news@hotmail.com> - 2011-08-29 07:52 +1200
Re: Create an istream from an fd? James Kanze <james.kanze@gmail.com> - 2011-08-29 03:54 -0700
Re: Create an istream from an fd? Leigh Johnston <leigh@i42.co.uk> - 2011-08-29 13:55 +0100
Re: Create an istream from an fd? Nobody <nobody@nowhere.com> - 2011-08-29 20:12 +0100
Re: Create an istream from an fd? Ian Collins <ian-news@hotmail.com> - 2011-08-30 07:49 +1200
Re: Create an istream from an fd? Nobody <nobody@nowhere.com> - 2011-08-30 04:40 +0100
Re: Create an istream from an fd? Ian Collins <ian-news@hotmail.com> - 2011-08-30 15:51 +1200
Re: Create an istream from an fd? Nobody <nobody@nowhere.com> - 2011-08-31 00:03 +0100
Re: Create an istream from an fd? Ian Collins <ian-news@hotmail.com> - 2011-08-31 11:55 +1200
Re: Create an istream from an fd? Nobody <nobody@nowhere.com> - 2011-09-02 00:50 +0100
Re: Create an istream from an fd? Ian Collins <ian-news@hotmail.com> - 2011-08-28 16:04 +1200
Re: Create an istream from an fd? Nobody <nobody@nowhere.com> - 2011-08-27 02:40 +0100
csiph-web