ToolTalk User's Guide

Returned Pointer Status

If an error occurs during a ToolTalk function that returns a pointer, the ToolTalk service provides an address within the ToolTalk API library that indicates the appropriate Tt_status code. To check whether the pointer is valid, you can use the ToolTalk macro tt_ptr_error. If the pointer is an error value, you can use tt_status_message to get the Tt_status character string.

Example 14–2 checks the pointer and retrieves and prints the Tt_status character string if an error value is found.

Example 14–2 Retrieving a Returned Pointer Status

char *old_spec_id, new_file, new_spec_id, my_application_name;
Tt_status tterr;

new_spec_id = tt_spec_move(old_spec_id, new_file);
tterr = tt_ptr_error(new_spec_id);
switch (tterr) {
    case TT_OK:
	 * Replace old_spec_id with new_spec_id in my internal
	 * data structures.
	update_my_spec_ids(old_spec_id, new_spec_id);
	 * The spec must have stayed in the same filesystem,
	 * since ToolTalk is reusing the spec id. Do nothing.
    case TT_ERR_FILE:
    case TT_ERR_ACCESS:
	fprintf(stderr, “%s: %s\n”, my_application_name,