#312 set error 'stderr_file'

None
closed-out-of-date
nobody
None
5
2016-01-09
2011-12-21
No

A very convenient way to control gnuplot from C under windows is
using a pipe:

FILE *pipe;
if ((pipe = _popen("gnulot.exe", "wt") != NULL) {
fprintf("plot x\n");
_pclose(pipe);
}

However the output of gnuplot to stderr can not retrieved that way

A solution could be a new gnuplot command

set error 'my_stderr_file'

which redirects stderr to 'my_stderr_file'

A very simple implementatio could be:

tables.h
add
S_ERROR,
to set_id

tables.c
add
{ "err$or", S_ERROR },
to set_tbl[]

set.c
add
case S_ERROR:
{
char * testfile = NULL;
c_token++;
if (END_OF_COMMAND) {
fprintf(stderr, "no file specified\n");
} else {
testfile = try_to_get_string();
}
if (testfile) {
gp_expand_tilde(&testfile);
fprintf(stderr, "redirect stderr to %s\n", testfile);
freopen(testfile, "w", stderr);
} else {
fprintf(stderr, "set error: file missing\n");
}
}
break;
to switch(lookup_table(&set_tbl[0],c_token)) {

A more advanced implementation would clone th logic of "set output 't.gif'"

Wilhelm Braunschober

Discussion

  • Ethan Merritt

    Ethan Merritt - 2015-05-22
    • status: open --> pending-accepted
    • Group: -->
     
  • Ethan Merritt

    Ethan Merritt - 2015-05-22

    Current CVS now supports a command "printerr" that works exactly like print except that output always goes to stderr. I think that judicious use of "set print", "print", and "printerr" can accomplish what you want.

     
  • Ethan Merritt

    Ethan Merritt - 2016-01-09
    • status: pending-accepted --> closed-out-of-date
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks