C++ Pass a string into a pipe to gnuplot -


i'm having small problem passing string gnuplot c++ can pass integers enough, when try string (user defined "title" earlier in code):

fprintf(gnuplotpipe, "set title %s\n", title); 

i error:

error: cannot pass objects of non-trivially-copyable type ‘std::string {aka class std::basic_string<char>}’ through ‘...’ 

so instead tried using:

fprintf(gnuplotpipe, "set title %s\n", title.c_str()); 

and code compiled, when ran got error gnuplot:

line 0: undefined variable: h 

where "h" test sting defined "title".

does have ideas on how pass this?

thanks in advance!

you have put title in quotes:

fprintf(gnuplotpipe, "set title \"%s\"\n", title.c_str()); 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -