TutFileTraverse


Name

TutFileTraverse — traverse open files

Synopsis

T_PTR TutFileTraverse(trav_func, trav_arg) 
T_FILE_TRAV_FUNC trav_func; 
T_PTR trav_arg; 

Arguments

trav_func — function to be called for each open file

trav_arg — traversal argument to pass to trav_func

Return Values

Last value returned by trav_func.

Diagnostics

If TutFileTraverse fails, it returns NULL without calling trav_func, and the global SmartSockets error number is set to:

Description

TutFileTraverse traverses all the files that have been opened and calls trav_func once for each of these files. The traversal continues until all the open files have been traversed, or until trav_func returns a non-null value. The last value returned by trav_func is returned to the caller.

Caution

None

See Also

TutSetFileOpenFunc, TutSetFileCloseFunc, TutSetFileReadFunc

Examples

This example traverses all open files and prints out the name and mode for the file:

T_ENTRY trav_func(file, arg) 
T_FILE file; 
T_PTR arg; 
{ 
  TutOut("File name: %s, mode %s\n", file->fname, file->mode); 
  return NULL; 
} 
TutFileTraverse(trav_func, NULL); 

TIBCO SmartSockets™ Utilities
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com