TMCloseFile Code Example
long session_handle;
unsigned char state_buffer[15360];
short file_handle,result;
/* session_handle set from a call to TMExtendedStartSession */
...
/* get the unique registration number of the device to communicate with using TMFirst,TMNext,TMRom... */
...
fentry.name[0] = 'D';
fentry.name[1] = 'E';
fentry.name[2] = 'M';
fentry.name[3] = 'O';
fentry.extension = 0;
/* try to open the file DEMO.000 */
file_handle = TMOpenFile(session_handle,state_buffer,&fentry);
if (file_handle >= 0)
{
/* file is opened, ready to read */
...
/* done with file so close it */
result = TMCloseFile(session_handle,state_buffer,file_handle);
if (result < 0)
{
/* error closing file */
...
}
}
else
{
/* error opening file */
...
}
/* close the session with a call to TMEndSession */
...