LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-27-2005, 11:33 PM   #1
Devika
LQ Newbie
 
Registered: Nov 2004
Posts: 1

Rep: Reputation: 0
Question not able to get fd of ofstream using stdio_filebuf


Hi,

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.


I tried following thing:

#include <ext/stdio_filebuf.h>
typedef __gnu_cxx::stdio_filebuf FILEBUF;


ofstream osf("somefile" , ios::app);
FILEBUF *fb ;
fb = dynamic_cast<FILEBUF *>(osf.rdbuf());

...But its not getting typecasted properly and i m getting segment fault.

Please help

Devika

Last edited by Devika; 03-28-2005 at 03:20 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with ifstream/ofstream kornerr Programming 2 07-04-2005 11:31 AM
ofstream and inheritence phoenix7 Programming 1 01-02-2005 02:52 AM
ofstream problem cgifalcon Linux - Software 2 10-19-2003 12:00 PM
strange ofstream output maarten Programming 2 09-16-2003 11:42 AM
c++ ofstream -> FILE * ChimpFace9000 Programming 1 08-25-2002 04:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration