gtpc2minC/C++ Language Support User's Guide

TPFxd_getPrevPosition-Retrieve Previous Positioning Information

This function is called to retrieve the position of the record that was just read or written.

Format

#include <c$tpxd.h>
long TPFxd_getPrevPosition (TPFxd_extToken  *token,
                            TPFxd_location  *positioningString);

token
The returned token from the TPFxd_archiveStart or TPFxd_open request.

positioningString
The location to use to return the previous positioning string. This string can then be used to reposition the current position.

Normal Return

The normal return is a positive value. The positioning string address provided on the function call will have the updated positioning string information in it.

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

The TPFxd_open function must be called before this request.

Examples

The following example writes an object to an external device and then position the device to the point before the object that was just written.

#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);
free(stufftowrite);
 
returncode = TPFxd_getPrevPosition (token,
                                    &whereIwas);
printf("getPrevPosition return code is %i\n",returncode);
TPFxd_setPosition (token,
                   &whereIwas);

  ·
  ·
  ·
}

Related Information