If a ToolTalk function does not have a natural return value, the return value is an element of Tt_status enum.
To see if there is an error, use the ToolTalk macro tt_is_err, which returns an integer.
If the return value is 0, the Tt_status enum is either TT_OK
or a warning.
If the return value is 1, the Tt_status enum is an error.
If there is an error, you can use the tt_status_message function to obtain the character string that explains the Tt_status code, as shown in Example 14-1.
char *spec_id, my_application_name; Tt_status tterr; tterr = tt_spec_write(spec_id); if (tt_is_err(tterr)) { fprintf(stderr, "%s: %s\n", my_application_name, tt_status_message(tterr)); } |