TMCreateFile Code Example

long session_handle;
unsigned char state_buffer[15360];
short file_handle, maxwrite;
FileEntry fentry;

/* 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 = 63;

/* try to create the file DEMO.063 */
file_handle = TMCreateFile(session_handle,state_buffer,&maxwrite, 
                &fentry);

if (file_handle >= 0)
{
   /* file is created, ready to write using file_handle */
   ...
}
else
{
   /* error creating file */
   ...
}    

/* close the opened file with a call to TMCloseFile */
...

/* close the session with a call to TMEndSession */
...