I can't get gnuplot to display the plot of sin(5). Here is what I've attempted...
But when I compile and run it, the program just exits. Below is what I getCode:#include <stdio.h> #include <stdlib.h> int main(void) { FILE *command; if ((command = popen("gnuplot", "w")) == NULL) { (void)fprintf(stderr, "pipe error\n"); exit(1); } if (setvbuf(command, NULL, _IONBF, 0) != 0) { (void)fprintf(stderr, "setbuf error\n"); exit(1); } (void)fprintf(command, "plot \"%s\" ", "sin(5)"); /*fflush(command);*/ pclose(command); exit(0); }
$ gcc -Wall -Wextra dd2.c -o dd2
$ ./dd2
$ echo $?
0
$



LinkBack URL
About LinkBacks


