<< Click to Display Table of Contents >>

 

zetafax_logo

ZfxSendSubmitFileFP

 


 

Send a single SUBMIT format file (old version).

 

Syntax

 

ZFERR FAR ZfxSendSubmitFileFP( ZFSESSIONHANDLE hSession, FILE *fpSubmit, char  FAR *lpszPrefix, char FAR *lpszBody)

 

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 %%[MESSAGE] line.

lpszPrefix

4 characters string giving the prefix to use when creating the  control and data files.

lpszBody

Address of buffer of length ZFMSG_BODY_LEN+1 used to return the message body  name if successfully submitted for sending.

 

 

Description

 

This routine interprets the given SUBMIT format file, creating a CONTROL file  and a DATA file (in ASCII text or Epson print format). It then calls the ZfxSendMsgEx  function to submit these files for sending, and if successful returns the name of the message submitted. This is the simplest method of submitting a fax using the API.  

 

The SUBMIT file must have been opened with read access - ie if the file is created by the application program first, then it should be opened with access "w+" not just "w".  

 

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 ZfxSendSubmitFile 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_MESSAGE_ALREADY_EXISTS

ZFERR_SERVER_NOT_RUNNING

ZFERR_SUBMIT_FILE_INVALID

ZFERR_INFO_FILE_OPEN_ERROR

ZFERR_INFO_FILE_ERROR

ZFERR_INFO_FILE_INVALID

ZFERR_CANNOT_SUBMIT_REQUEST

 

Example

 

#include  <stdio.h>

#include <zfapi.h>

...

 

if ((fp = fopen("XYZ.TMP", "w+b")) != NULL)

{

 fputs("%%[MESSAGE]\r\n", fp);

 fputs("From: Fred Smith\r\n", fp);

       fputs("To: Jim Jones\r\n", fp);

       fputs("Fax: 123 456 7890\r\n", fp);

       fputs("%%[TEXT]\r\n", fp);

       fputs("Hello Jim\r\n", fp);

       fseek(fp, 0L, SEEK_SET);

 Err = ZfxSendSubmitFileFP(hSession, fp, "XSUB",  szBody);

 fclose(fp);

 remove("XYZ.TMP");

}

 

if (Err == 0)

{

  printf("Submitted message %s\n", szBody);

}

 

Related topics

Alphabetical reference

Function error returns and reference