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
Post a Comment