TutSetFileCloseFunc sets the function to use when closing a file
close_func
function to use when closing a file
TRUE
if successful, FALSE
otherwise.
None
TutSetFileCloseFunc allows you to specify a function used to close a file when the process is done with it.
The default close function is fclose. If NULL
is specified for close_func
, the default is used for subsequent close file operations.
None
TutSetFileOpenFunc, TutSetFileReadFunc, TutFileTraverse
This example uses TutSetFileCloseFunc to perform post-processing on a data file:
static T_PTR find_name(t_file, arg) T_FILE t_file; T_PTR arg; { if (t_file->file == (FILE *)arg) { return t_file->fname; } return NULL; }/* find_name */
static T_BOOL close_func(file) FILE *file; { T_STR fname; fname = TutFileTraverse(find_name, file); if (fname == NULL) {/* error */
} fclose(file); TutOut("Closing file %s\n", fname); postprocess_file(fname);/* user provided function */
} . . . TutSetFileCloseFunc(close_func); . . .
TIBCO SmartSockets™ Utilities Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |