next up previous contents index
Next: Return values of commands Up: Programming with the interpreter Previous: Questions and answers inside   Contents   Index


Monitor files

It is possible to write in a file all the instructions executed by the command interpreter, and the messages printed on screen by it, using the command mon.... The syntax is

mon xxx

where xxx is a file name. If this instruction is given, the file is created if it did not exist, otherwise the old one erased and a new file with the same name is created. All the subsequent instructions and messages of the command interpreter will be written not only on screen but also in this file, until the program ends, or the instruction end_mon appears. In the later case, the monitor file is closed. For the messages that come from functions written by the user, the function

void print(flow_data *, char*, ...);

can be used instead of the usual printf (here flow_data is a structure type used to describe threads (cf. 10.4)). This function prints on screen and on the monitor file, if it has been defined. Only the flags %d, %f and %s have been implemented.

Note that a monitor file corresponds to the the thread in which it has been created, and will store only messages coming from this thread. So several distinct threads can use their own monitor file simultaneously (of course in this case the monitor files must be distinct).


next up previous contents index
Next: Return values of commands Up: Programming with the interpreter Previous: Questions and answers inside   Contents   Index
2009-11-12