TMChangeDirectory Code Example

long session_handle;
unsigned char state_buffer[15360];
short result;
DirectoryPath cd_buf;

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

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

/* set the current directory to \WORK\TMP */
cd_buf.NumEntries = 2;
cd_buf.Ref = '\\';
cd_buf.Entries[0][0] = 'W';
cd_buf.Entries[0][1] = 'O';
cd_buf.Entries[0][2] = 'R';
cd_buf.Entries[0][3] = 'K';
cd_buf.Entries[1][0] = 'T';
cd_buf.Entries[1][1] = 'M';
cd_buf.Entries[1][2] = 'P';
cd_buf.Entries[1][3] = ' ';

result = TMChangeDirectory(session_handle, status_buffer, 0, &cd_buf);

if (result == 1)
{
   /* current directory set */
   ...
}
else
{
   /* error setting current directory to \WORK\TMP */
   ...
}

/* read the current directory */
result = TMChangeDirectory(session_handle, status_buffer, 1, &cd_buf);

if (result == 1)
{
   /* current directory read, should be \WORK\TMP */
   ...
}
else
{
   /* error reading current directory */
   ...
}

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