我正在尝试使用 C++ 通过命令行打开 gnuplot 并编译图形

I am trying to open a gnuplot through command line using c++ and compile a graph

我的密码是

int gnuplot() {

    FILE *gnu;
    gnu = _popen(" gnuplot ", "r");

    fprintf(gnu, "plot \'C:/Users/user/Documents/gnuplot/cpp/FFT/file.dat\' with linespoints \n ");

    fflush(gnu); // I'm not sure how or if this will help, I thought it was related

    _pclose(gnu);

     return 0;
}

目前我只能打开枪图 window 的 CMD window 但不能输入或退出绘图命令。

gnu = _popen(" gnuplot ", "r");

应该是写入模式。

gnu = _popen("gnuplot ", "w");