TMTerminateAddFile 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... */
...

/* call TMCreateProgramJob to set up EPROM writing */
...

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

/* try to Terminate the 'add' file DEMO.100 */
result = TMTerminateAddFile(session_handle,state_buffer,&fentry);

if (result >= 0)
{
   /* 'add' file is terminated */
   ...
}
else
{
   /* error terminating 'add' file */
   ...
}    

/* Call TMDoProgramJob until EPROM programming is complete */
...

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