TMFirstFile Code Example

long session_handle;
unsigned char state_buffer[15360];
FileEntry fentry;
char buf[100];
short result;

/* session_handle set from a call to TMExtendedStartSession */
...

/* get the unique registration number of the device to communicate with using TMFirst,TMNext,TMRom... */
...

result = TMFirstFile(session_handle,state_buffer,&fentry);

if (result < 0)
{
    /* FILE_OPERATIONS error */
    ...
}
else
{
    /* success, first file is in fentry */
    sprintf(buf,"First file is %.4s.%03d",
                        fentry.name,fentry.extension);
    ...
}

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