TMOpenFile Overview Group

The TMOpenFile API call opens a file for a future call to one of several file API functions. The ‘file_handle’ returned from this function can be used with the TMReadFile and TMWriteAddFile API calls. The filename to open is specified in 'fentry' which is in the structure FileEntry. Only the 'name' and 'extension' portions of FileEntry need to be set before calling TMOpenFile. The file must be in the current directory on the current device on the 1-Wire network specified by the session handle 'session_handle'.


short far pascal TMOpenFile(

long session_handle,    // session handle for the desired 1-Wire network
void far *state_buffer, // state buffer provided for the 1-Wire network session
FileEntry far *fentry   // pointer to a structure with the file information
);

For a description of the above types, see the TMEX Type Descriptions.

Parameters

session_handle

Specifies the session handle returned from the API function TMExtendedStartSession that specifies the desired 1-Wire network port. This parameter is required by most TMEX API functions.

state_buffer

Specifies a pointer to a memory location that TMEX keeps all of the state information for the 1-Wire networks. This parameter is required by most TMEX API functions.

fentry

Specifies a pointer to a memory location that contains a FileEntry structure. This structure must have the name and extension portions set before calling this API.

Return Value

>= 0 => file found, and this is the file handle

<0 => TMEX File Operations Error Return Code

Code Example

See Also

TMFirstFile, TMNextFile, TMReadFile