<< Click to Display Table of Contents >>

 

zetafax_logo

ZfxCreateCtlFileEx

 


 

Create a CONTROL file from SUBMIT format file.

 

Syntax

 

ZFERR FAR ZfxCreateCtlFileEx( ZFSESSIONHANDLE hSession, char FAR  *lpszSubmitFile, char FAR *lpszControlFile, char FAR *lpszDataExtn, char FAR  *lpszDataExtnBuf, short MsgInfoExSize, ZFMSGINFOEX FAR *lpMsgInfoEx)

 

Parameters

 

Parameter

Description

hSession

API session handle, as returned by ZfxAPIInit  call lpszSubmitFileName of submit file (with path if not in current directory)

lpszControl

FileName of new CONTROL file (with path if not in current  directory)lpszDataExtnData file extension for the required format, or NULL to use  the default (or to allow the Syntax line in the SUBMIT file to overwrite the  default).

lpszDataExtnBuf

Address of buffer of length 4 bytes. On return this will contain the data file extension to use. If the lpszDataExtn parameter was given as NULL then this will give the data format specified in the Syntax line in the SUBMIT file (or the default value of TXT for straight ASCII text if this line is not specified). If the lpszDataExtn was specified then an error is returned if the SUBMIT file contains a Syntax line which contradicts this.

MsgInfoExSize

Size of structure - should be set to sizeof(ZFMSGINFOEX)lpMsgInfoEx Address of a single ZFMSGINFOEX structure, which is filled with the details of  the message (body, comment etc) on return.

 

 

Description

 

This routine interprets the %%[MESSAGE] 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.

 

Return value

 

The routine returns 0 if successful, otherwise one of the following:

 

ZFERR_NOT_INITIALISED

ZFERR_INVALID_PARAMETERS

ZFERR_FILE_ERROR

ZFERR_FILE_OPEN_ERROR

ZFERR_FILE_CREATE_ERROR

ZFERR_SUBMIT_FILE_INVALID

 

Example

 

#include  <stdio.h>

#include <zfapi.h>

...

 

/* create .CTL file in user's OUT directory  */

 

ZfxGetUserOutDir(hSession, szOutDir, sizeof(szOutDir));

 

ZfxCreateAutoFile(hSession, "XSUB", "CTL", szOutDir, MsgInfoEx.szBody);

 

/* get name of the CTL file we've just  created */

 

sprintf(szPath, "%s%s.CTL", szOutDir, MsgInfoEx.szBody);

 

/* interpret the SUBMIT file created earlier  */  

/* to send an existing file of format G3F */

 

ZfxCreateCtlFileEx(hSession, "MYFILE.SUB", szPath, "G3F", szDataExtn, sizeof(ZFMSGINFOEX), &MsgInfoEx);

 

/* Create data file in OUT directory */

 

sprintf(szPath, "%s%s.G3F", szOutDir, MsgInfoEx.szBody);

...

 

/* submit files */

 

ZfxSendMsgEx(hSession, "G3F", sizeof(ZFMSGINFOEX), &MsgInfoEx);

 

Related topics

Alphabetical reference

Function error returns and reference