|
From: Per W. <pw...@ia...> - 2006-05-09 05:34:14
|
My mistake :(
The (int fd) constructor was only available as a non-standard extension
in the old fstream classes.
/Per W
On Mon, 8 May 2006, Erik Schmidt wrote:
> I was told to use fileno and an fstream constructor to convert a
> FILE* to an fstream.
>
> I'm trying to do this on a mac, here's the ode that failed:
>
> #include <iostream>
> #include <cstdio>
> #include <string>
> #include <fstream>
>
> using namespace std;
>
> int main(int argc,char *argv[]){
>
> fstream pipe(fileno(popen("ls","r")));
>
> string total;
> char c;
>
> cout<<"initialized"<<endl;
>
> while((pipe.get(c))!=NULL){
>
> total+=c;
>
> }
>
> cout<<total<<endl;
>
> pipe.close();
>
> return 0;
>
> }
>
> any ideas why this doesn't work
>
>
> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|