Legalize access to file descriptors now! (So sue me.)

Jonathan Wakely cow@compsoc.man.ac.uk
Thu Feb 17 12:55:00 GMT 2005


On Wed, Feb 16, 2005 at 11:56:29PM +0100, Richard B. Kreckel wrote:

> Since we've had the discussion whether to allow access to file descriptors
> from C++ stream objects more than once without any result, I've had to
> hack my way through to the file descriptors by applying a good amount of
> brute force (not to mention all the beer).
> 
> So, here is my lament: http://www.ginac.de/~kreckel/fileno/.  Could you
> folks please, please make the access a little bit more smooth?  We need
> the
> file descriptor.  We are going to get it.  Don't prolong the agony.

Am I missing it, or is there no link to download the code?  I seem to
have to copy'n'paste from the webpage.

First reactions after trying to use the code:

fileno(3) is a macro on BSD - so declaring a template function overload
fails, as does referring to it as ::fileno().

You also need to wrap the instantiation of the wide-stream
specialisation in a check for _GLIBCXX_USE_WCHAR_T or
_GLIBCPP_USE_WCHAR_T for platforms that don't support wchar_t I/O.

I've got past that so I'll keep playing ...

jon

-- 
"God not only plays dice, he also sometimes throws the dice where they 
 cannot be seen."
	- Steven Hawking



More information about the Libstdc++ mailing list