Synopsis:
term_errctl(off_or_on_)
Arguments:
off_or_on - Set to 0 to turn error supress off, or 1 to turn error supress on.
Description: This function allows the application to suppress the printing of error messages to the error log and application log. This is typically used when the programmer knows that an error message might be generated but this would be an expected behaviour that doesn't need to be printed to the log. A typical example of when term_errctl() could be used to suppress an error message is shown below:
# Check if the control file exists..
term_errctl(1); # Prevent 'file not found' error message from printing..
fh=sys_fhopen("control.txt","rs");
term_errctl(0); # switch error suppression off again
# if it does exist then do something
if(fh > 0)
sys_fhclose(fh);
# Do something....
etc.
endif
In the above example we are checking for the existance or non-existance of a control file to adjust the program flow. Since the non-existance of the file is a perfectly valid event then we don't want to print out the 'file not found' error that the sys_fhopen() would print out.
Another example is shown below:
term_errctl(1); # Suppress error messages
SMplay(vox_chan,"advert.vox"); # play the optional advert if it exists
term_errctrl(0); # allow error logging again
In the above example the program attempts to play 'advert.vox', but if this doesn't exist then the program will simply return immediately and drop through. Since the 'advert.vox' is an option prompt then we supress the printing of the 'file not found' mesage that SMplay() would normally generate.
Return Value: Returns 0