help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: not able to get fd of ofstream using stdio_filebuf


From: James Kanze
Subject: Re: not able to get fd of ofstream using stdio_filebuf
Date: Sat, 02 Apr 2005 14:03:11 +0200
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

Ulrich Eckhardt wrote:
> Devika wrote:

>>I want to call fcntl function for which I need fd(). The code
>>part is smthing like :

>>ofstream osf("somefile" , ios::app);

>>filebuf * fb ;
>>fb = osf.rdbuf();

>>fcntl(fb -> fd(), F_SETLKW, &cfLock);

>>Now this code was working fine with gcc 2.96 but now it[gcc
>>3.2.3] says no matching function for fd() since the function
>>fd() of basic_filebuf has been removed in gcc 3.2.3. and they
>>have provided new extension stdio_filebuf.

> 1. http://gcc.gnu.org/gcc-2.96.html
> 2. access to underlying filedescriptors was never part of C++
> iostreams, although GCC's C++ stdlibrary provided means for
> that.

That's not really true.  Access to underlying file descriptors
was part of the original classical iostream.  The standard
didn't endorse it because not all systems have such a thing, but
it seems obvious that no serious compiler purveyor will want to
break existing code, especially when such code was compatible
with the previous existing practice.

--
James Kanze                                 mailto: james.kanze@free.fr
Conseils en informatique orientée objet/
                       Beratung in objektorientierter Datenverarbeitung
9 pl. Pierre Sémard, 78210 St.-Cyr-l'École, France +33 (0)1 30 23 00 34


reply via email to

[Prev in Thread] Current Thread [Next in Thread]