TMAttribute Code Example

long session_handle;
unsigned char state_buffer[15360];
FileEntry fentry;
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... */
...

fentry.name[0] = 'D';
fentry.name[1] = 'E';
fentry.name[2] = 'M';
fentry.name[3] = 'O';
fentry.extension = 0;

/* make file DEMO.000 read-only */
result = TMAttribute(session_handle, state_buffer, 0x01, &fentry);

if (result < 0)
{
   /* error setting file attribute */
   ...
}

fentry.name[0] = 'S';
fentry.name[1] = 'U';
fentry.name[2] = 'B';
fentry.name[3] = ' ';
fentry.extension = 0x7F;

/* make sub-directory SUB hidden */
result = TMAttribute(session_handle, state_buffer, 0x02, &fentry);

if (result < 0)
{
   /* error setting attribute on sub-directory */
   ...
}

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