TMWriteAddFile Code Example
long session_handle;
unsigned char state_buffer[15360];
unsigned char write_buffer[500];
short len, file_handle;
/* session_handle set from a call to TMExtendedStartSession */
...
/* get the unique registration number of the device to communicate with using TMFirst,TMNext,TMRom... */
...
/* file_handle set from call to TMOpenFile */
...
/* create the message to append to the 'add' file */
sprintf(write_buffer,"This is a test");
/* append to the file */
len = TMWriteAddFile(session_handle, state_buffer, file_handle, 1, 0, write_buffer, strlen(write_buffer));
if (len > 0)
{
/* file was written */
...
}
else
{
/* error writing file */
...
}
OR
/* clear bit 0 of the 10th byte in the 'add' file specified by 'file_handle */
write_buffer[0] = 0xFE;
/* clear the bit */
len = TMWriteAddFile(session_handle, state_buffer, file_handle, 0, 10, write_buffer, 1);
if (len > 0)
{
/* bit was cleared */
...
}
else
{
/* error writing to the 'add' file */
...
}
/* close the opened file with a call to TMCloseFile */
...
/* close the session with a call to TMEndSession */
...