TutSetFileOpenFunc


Name

TutSetFileOpenFunc — set the function to use when opening a file

Synopsis

T_BOOL TutSetFileOpenFunc(open_func) 
T_FILE_OPEN_FUNC open_func; 

Arguments

open_func — function to be used to open a file

Return Values

TRUE if successful, FALSE otherwise.

Diagnostics

None

Description

TutSetFileOpenFunc allows you to specify a function used to open a file, instead of the default TutFOpen. This makes it possible to set up input data to come from a different place, or perform pre-processing on the file before it is read.

If NULL is specified for open_func, the default open function TutFOpen is used for subsequent file open operations.

Caution

None

See Also

TutSetFileCloseFunc, TutSetFileReadFunc, TutFOpen, TutFileTraverse

Examples

This example performs pre-processing on a file before opening it:

static FILE *open_func(file_name, file_mode) 
T_STR file_name; 
T_STR file_mode; 
{ 
  if (strcmp(file_mode, "r")) { 
    return TutFOpen(file_name, file_mode); 
  } 
  preprocess_file(file_name);   /* User written pre-processing */ 
  return TutFOpen(file_name, file_mode); 
} /* open_func */ 
. 
. 
. 
TutSetFileOpenFunc(open_func); 
. 
. 
. 

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