With C++03 (or even C) use backslashes to escapes double-quotes in string literals:
gnuplot_file << "set title" << "\"one-D Hydro\"" << std::endl;
Notice that gnuplot
may require you to also escape some characters, e.g. if you wanted the title to contain quotes!
With C++11 you could use raw string literals, e.g.
gnuplot_file<< R"*(set title "one-D Hydro")*" << std::endl;
BTW, you could be interested by popen(3) and pclose
, if your operating system and C++ library provides them. You would just popen
the gnuplot
process and send commands to it, finally pclose
-ing it.