FHANDLE VFOpen(filename,flags,permissions) This function is used to open your program's data file(s). The filename must be fully qualified since it is written to the transaction log file. The flags and permissions are any valid combination permitted by the operating system. The function returns BADFHANDLE if the file cannot be opened. Otherwise it returns a valid FHANDLE.BOOL VFClose( dataHandle ) This functions closes a program's data file(s). It returns TRUE if successful, and FALSE otherwise. The dataHandle must have been obtained from a call to VFOpen().
FHANDLE OpenTransact( logName, logType ) As with data files, the logName must be a fully qualified filename. The logType can be either NORMAL_TRANS or DEL_ON_CLOSE. If you specify NORMAL_TRANS, you must make an explicit call to DeleteTransactionFile() after closing the log file. If you specify DEL_ON_CLOSE, the log file is automatically deleted after it is closed. The function returns BADFHANDLE if the log file cannot be created or if the rollback of an existing log file failed. Otherwise, a valid FHANDLE is returned.
BOOL CloseTransact( logHandle ) To close a transaction log file, pass this function the FHANDLE returned by OpenTransact(). It will return TRUE if the log file is closed and, if specified, deleted. Otherwise, FALSE is returned.
BOOL DeleteTransactionFile( logName ) If you specify NORMAL_TRANS alone in a call to OpenTransact(), you must call this function with the same logName when you wish to commit all transactions recorded in the log file. The function will return TRUE if the file is successfully deleted, and FALSE otherwise.
BOOL BeginTransaction( dataHandle, logHandle ) This function associates the data file with the indicated transaction log file. Subsequent changes to the data file will be tracked using the log file. dataHandle is the return value of VFOpen() and logHandle is from OpenTransact(). TRUE is returned if the association is established; FALSE otherwise.
BOOL EndTransaction( dataHandle, logHandle ) This function terminates an update session begun with a call to BeginTransaction(). It takes the same parameters as the corresponding BeginTransaction call. TRUE is returned if the tracking is discontinued.
int VFRead( dataHandle, buffer, bytes ) This function retrieves data from the data file associated with dataHandle. It assumes that buffer is large enough to hold the number of bytes specified by bytes. On error it returns -1, otherwise, it returns the number of bytes retrieved from the data file.
int VFWrite( dataHandle, buffer, bytes ) This function writes up to bytes characters from buffer to the data file associated with dataHandle. If the data file has been associated with a transaction log file using BeginTransaction(), the necessary transaction records will be recorded. The return value is -1 if an error occurs; otherwise the number of bytes written to the data file is returned.
long VFLSeek( dataHandle, offset, whence ) This function repositions the current file location of the data file specified by dataHandle. Repositioning is relative to either the start of the file (whence=0), the current file position (whence=1) or the end of file (whence=2). The file position may not be positioned before byte 0 or beyond the current end-of-file. The return value is -1L in case of error. Otherwise, the new file position is returned.
long VFTell( dataHandle ) This function returns the current file position; a shorthand for VFLSeek( dataHandle, 0L, 0).
BOOL VFLocking( dataHandle, lockType, bytes ) This function locks a portion of a data file. The lock starts at the current file position and extends for the specified number of bytes. The lockType may be either SHARED_LOCK (permits other processes to read the bytes), EXCLUSIVE_LOCK (blocks all access to the locked bytes) or UNLOCK_BYTES (releases locks on the bytes). The return value is TRUE if the operation is successful or FALSE if it fails.
BOOL VFChangeSize( dataHandle, newSize ) This function changes the length of the data file to the number of bytes specified. If the file is extended, the new region is filled with zeros. currently being tracked, the proper transaction record is written to the log file. The function returns TRUE if the file's size is successfully altered. NOTE: This function always returns FALSE (failure) under SCO UNIX.
BOOL VFStat( dataHandle, statStruck ) This function fills the stat structure parameter with environment specific data concerning the file associated with dataHandle. It returns TRUE if able to retrieve the data; else FALSE.
int VFLastError() Whenever a function returns a failure code, calling this function will indicate the cause of the problem. This function should be called immediately as all functions zero the error code variable on entry.