M
Markus Dehmann
Can I get a dumb FILE * pointer from a C++ stream?
#include <iostream>
#include <sstream>
using namespace std;
int main(){
stringstream my_stream;
my_stream << "Hello World!" << endl;
// FILE *p = ???;
}
The reason is that I work with a C library that needs a FILE pointer,
but I am calling it from C++ and want to pass a string, actually. I
cannot use fmemopen, because it is not portable (only GNU).
Thanks
Markus
#include <iostream>
#include <sstream>
using namespace std;
int main(){
stringstream my_stream;
my_stream << "Hello World!" << endl;
// FILE *p = ???;
}
The reason is that I work with a C library that needs a FILE pointer,
but I am calling it from C++ and want to pass a string, actually. I
cannot use fmemopen, because it is not portable (only GNU).
Thanks
Markus