gtpc2miwC/C++ Language Support User's Guide

TPFxd_write-Write to an External Device

This function is used to write data from the malloc area to an external device. The maximum write size is 32 000 bytes.

Format

#include <c$tpxd.h>
long TPFxd_write (TPFxd_extToken *token,
                  u_char         *data,
                  long           *dataLength);

token
The returned token from the TPFxd_archiveStart or TPFxd_open request.

data
The pointer to the start of the data to write.

dataLength
The pointer to the length of the data to write.

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 a core area to an external device.

#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);
TPFxd_open (&token,
            &wherefirst,
            howbigitis,
            howlongtowait,
            message,
            mode );
stufftowrite = malloc(howbigitis);

  ·
  ·
  ·
returncode = TPFxd_write(token,stufftowrite,&howbigitis); printf("write complete with return code %i\n",returncode); free(stufftowrite);
  ·
  ·
  ·
}

Related Information