Alex Rivera | Logout

How to Access File Descriptor of Open File

Asked 2010-08-18T14:32:40.337
9

Is there any way to access the file descriptor of a file opened in c++? So ...

 #include <iostream>
 #include <fstream>
 using namespace std;

 int main() {
      ifstream inputFile( "file.txt",ios::in );
      cout << inputFile.fileDesc << endl;//made up call
      return 0;
 }

The question is, does something like fileDesc exist for ifstreams? If not how would I go about doing this?

Edit
Report

1 Answer

6

If you're trying to get to the FILE* from the stream then the answer is basically "you can't" as stated by more enlightened people than me here.

answered 2010-08-18T14:39:36.533

Your Answer