TMReadFile Overview Group

The TMReadFile API call reads from the file specified by the file handle number 'file_handle' and copies it into the buffer 'read_buffer', not to exceed ‘buff_size’ bytes (which should be the size of the read_buffer being provided). 'file_handle' must be set as a result of a call to TMOpenFile. If the file to read is an ‘add’ file with extension 100 decimal then the file length will be in page increments. For example if the last data byte is in the 30th byte of the file, the length will go to the end of the page which would give a length of (2*28) or 56 bytes. If the file to read is a ‘Monetary File ‘ with extension 101, the length of the buffer is at least 36 bytes long (28 bytes for the ‘Monetary File’ + 8 bytes for the Counter and Tamper bytes to append).

short far pascal TMReadFile(

long session_handle,             // session handle for the desired 1-Wire network
void far *state_buffer,          // state buffer provided for the 1-Wire network session
short file_handle,               // file handle
unsigned char far *read_buffer,  // buffer to hold the file data read
short buff_size                  // the size that the buffer can hold in bytes

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



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.


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.


Specifies a file handle of the file to read.


Specifies a pointer to a buffer that will hold the data read from the file. It must be at least ‘max_read’ bytes long.


Specifies the size of ‘read_buffer’ in bytes. If the file length is longer than ‘buff_size’, an error is returned.

Return Value

>= 0 => file read, and this is the number of bytes

<0 => TMEX File Operations Error Return Code

Code Example

See Also