gtpc2milC/C++ Language Support User's Guide

TPFxd_close-Signal the End of a TPFxd_open Request

This function is called for each TPFxd_open request to indicate that all the read or write operations are completed successfully and any cleanup needed must be performed in preparation for the next TPFxd_open or TPFxd_archiveEnd request.

Format

#include <c$tpxd.h>
long TPFxd_close (TPFxd_extToken  *token)

token
The returned token from the TPFxd_archiveStart or TPFxd_open request.

Normal Return

A return code of 1 indicates a normal return.

Error Return

An error return is indicated by a negative return code. For a list of error codes applicable to this function, see Error Codes.

Programming Considerations

Examples

The following example shows a TPFxd_open request after a TPFxd_archiveStart request; after writing one object to the device, TPFxd_write will issue a TPFxd_close request.

#include <c$tpxd.h>
long example()
{
TPFxd_extToken    *token;
TPFxd_locationMap wherefirst;
enum              tpxd_mode mode;
enum              tpxd_opts access;
long              howbigitis;
long              howlongtowait;
char              *message;
long              returncode;
char              *stufftowrite;
 
howlongtowait = 60;
howbigitis = 32000;
message = NULL;
token = NULL;
mode = WT;
access = IMMEDIATE;
TPFxd_archiveStart (&token, mode, access);
returncode = TPFxd_open (&token,
            &wherefirst,
            howbigitis,
            howlongtowait,
            message,
            mode );
 
stufftowrite = malloc(howbigitis);
TPFxd_write(token,stufftowrite,&howbigitis);
free(stufftowrite);
TPFxd_close (token);

  ·
  ·
  ·
}

Related Information