Using pipes inside a class in C++
- by Paul
I'm trying to use this tutorial to make plots with Gnuplot in C++. However I will be using the pipe to Gnuplot from within a class, but then I run into some problems:
I've got a header file where I declare all variables etc. I need to declare the pipe-variable here too, but how do I do that?
I've tried doing it straight away, but it doesn't work:
Logger.h:
class Logger {
FILE pipe;
}
Logger.cpp:
Logger::Logger() { //Constructor
*pipe = popen("gnuplot -persist","w");
}
Gives the error Logger.cpp:28: error: no match for ‘operator=’ in ‘*((Logger*)this)->Logger::pipe = popen(((const char*)"gnuplot -persist"), ((const char*)"w"))’
Suggestions?