<< Click to Display Table of Contents >>
ZfxCreateDataFileFP
Create a DATA file (old version).
Syntax
ZFERR FAR ZfxCreateDataFile( ZFSESSIONHANDLE hSession, FILE *fpSubmit, FILE *fpData, char FAR *lpszDataExtn)
Parameters
Parameter |
Description |
hSession |
API session handle, as returned by ZfxAPIInit call |
fpSubmit |
File pointer for SUBMIT format file, opened in binary mode with read access (eg an "rb" parameter to the fopen call). The file pointer should be positioned at the start of the %%[TEXT] line. The routine interprets all the file from the current position to the end of the file, treating the contents as the message to be sent. |
fpData |
File pointer for new DATA file, opened in binary mode with write access. |
lpszDataExtn |
Data file extension for the required format - either "TXT" for ASCII text, or "EPN" for Epson print format. |
Description
This routine interprets the %%[TEXT] of a given SUBMIT format file, writing the details to the given CONTROL file. It is used where the ZfxSendSubmitFile function does not give sufficient flexibility - for example when wishing to send an existing data file.
NOTE - this routine is supplied for historic reasons to assist porting applications written for an older version of the API. Because of its use of file pointers is only supported in the static library version of the API, not the DLL. New programs should use the ZfxCreateDataFile function instead.
Return Value
The routine returns 0 if successful, otherwise one of the following:
ZFERR_NOT_INITIALISED
ZFERR_INVALID_PARAMETERS
ZFERR_FILE_ERROR
ZFERR_SUBMIT_FILE_INVALID
Example
#include <stdio.h>
#include <zfapi.h>
...
/* create .CTL file in user's OUT directory */
...
/* create data file */
sprintf(szPath, "%s%s.EPN", szOutDir, szBody);
fpData = fopen(szPath, "wb");
ZfxCreateDataFileFP(hSession, fpSubmit, fpData, "EPN");
fclose(fpData);
/* submit files */
...
Related topics