Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
No replies
SystemAdmin
SystemAdmin
196 Posts
ACCEPTED ANSWER

Pinned topic Getting "cannot convert int to FILE *" error message

‏2010-05-09T06:05:16Z |

Hi All,

I am getting the following error message while running the below given code snippet with xlC v8 compiler on AIX 5.3.

Error: Cannot convert int to FILE *

#include<fstream>
#include<iostream>

using namespace std;
int main()
{
int fdd;
ofstream ofs;
fdd=ofs.rdbuf()->fd();
if(fdd == -1 )
cout<<"failed";<br />
return 0;
}
The same code works with non-standard headers fstream.h and iostream.h but with standard headers it is not working. Does anybody has any idea how to resolve this error with standard headers?
Thanks in advance,
Sharan

Updated on 2010-05-10T01:13:19Z at 2010-05-10T01:13:19Z by vijayka
  • vijayka
    vijayka
    2 Posts
    ACCEPTED ANSWER

    Re: Getting "cannot convert int to FILE *" error message

    ‏2010-05-10T01:13:19Z  in response to SystemAdmin

    It seems that fstream is defines fdd() to return FILE * type that gets picked up from yvals.h where _Filet is defined as FILE.
    I think using fstream.h and iostream.h is the best alternative as I checked this in version 10.1 of XLC compiler.