gtpc2mivC/C++ Language Support User's Guide

TPFxd_sync-Verify Queued Information

This function is used to ensure that any information queued to the external device has successfully been written to the device. Before a TPFxd_sync request, any data may still reside in a host or device buffer.

Format

#include <c$tpxd.h>
long TPFxd_sync (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 writes an object to an external device and then issues a TPFxd_sync request to ensure that the object was successfully written to the device and does not reside in a hardware or software buffer.

#include <c$tpxd.h>
long example()
{
TPFxd_extToken    *token;
TPFxd_locationMap wherefirst;
TPFxd_location    whereIwas;
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);
TPFxd_open (&token,
            &wherefirst,
            howbigitis,
            howlongtowait,
            message,
            mode );
stufftowrite = malloc(howbigitis);
TPFxd_write(token,stufftowrite,&howbigitis);
 
returncode = TPFxd_sync (token);
printf("sync complete with return code %i\n",returncode);
 
free(stufftowrite);

  ·
  ·
  ·
}

Related Information