tfFSOpenFile

Jump to: navigation, search

Table of Contents >> Application Reference >> File System Interface


#include <trsocket.h>


void * tfFSOpenFile (
void * userDataPtr,
char * pathNamePtr,
int flag,
int type,
int structure
);


Function Description

Given the unique user data pointer as returned by tfFSUserLogin() and a file name, this function opens the file for either read (if 'flag' is TM_FS_READ), write (if 'flag' is TM_FS_WRITE), or append (if 'flag' is TM_FS_APPEND).

The 'type' parameter specifies if file type is ASCII (TM_TYPE_ASCII) or binary (TM_TYPE_BINARY).

The 'structure' parameter specifies if the file structure is stream (TM_STRU_STREAM), or record (TM_STRU_RECORD).

This function allocates a file data structure to store the file pointer, file type, file structure, etc.


Parameters

  • userDataPtr
    Pointer to user data structure as returned by tfFSUserLogin().
  • pathNamePtr
    Pointer to a null terminated string containing file name.
  • flag
    Open flag: TM_FS_READ, TM_FS_WRITE, TM_FS_APPEND.
  • type
    File type: TM_TYPE_ASCII or TM_TYPE_BINARY.
  • structure
    File structure: TM_STRU_RECORD, or TM_STRU_STREAM.


Returns

  • (void *)0
    Failure.
  • (Other)
    Pointer to newly allocated file data structure.


Table of Contents >> Application Reference >> File System Interface