gnuplot-cpp cannot feed command to pipe

2019-02-28 20:36发布

问题:

I'm using gnuplot-cpp to draw math graphs using C++. As I vaguely understand, this is an interface which feeds command to pgnuplot.exe and shows the output in another GUI.

So far, I've got the error like:

'C:\Program' is not recognized as an internal or external command...

the original command of which fed to the pipe is:

"C:\Program Files (x86)\gnuplot\bin/pgnuplot.exe"

the same command executed in _access(cmd) returns TRUE for the existence of the executable whereas it returns the error described priorily when executed in _popen(cmd,"w");

I'm wondering the error comes from the cmd string format and I've tried "/", "\", "\\"... but nothing works

the 2 code files are gnuplot_i.hpp and example.cc

Thank you in advance for any help!

Edit 01:

I've updated the two code files. They contain some of my supplementary edits

回答1:

This is a known bug of gnuplot-cpp, see the issue Blanks in gnuplot path cause failure.

As workaround you can add the gnuplot directory to your PATH and call only pgnuplot.exe.



标签: c++ pipe gnuplot