<< Click to Display Table of Contents >>






Create a CONTROL file (old version).




ZFERR FAR ZfxCreateCtlFileFP( ZFSESSIONHANDLE hSession, FILE *fpSubmit, FILE  *fpControl, char FAR *lpszBody, char FAR *lpszDataExtn, char FAR  *lpszDataExtnBuf, char FAR *lpszCommentBuf)







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. On return the file pointer is positioned at  the start of the next line found in the file which starts with "%%" (signifying  the end of the %%MESSAGE section) if one exists, or the end of file otherwise.fpControl File pointer for new CONTROL file, opened with in binary mode with write  access.


Message body name (base name of control and data file)  lpszDataExtn-Data 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).


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.


Buf Address of buffer of length ZFMSG_COMMENT_LEN+1 used to return the message  comment for specifying in a subsequent ZfxSendMsg call.




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.

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 ZfxCreateCtlFileEx function instead.


Return value


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









#include  <stdio.h>

#include <zfapi.h>


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

ZfxGetUserOutDir(hSession, szOutDir, sizeof(szOutDir);

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


/* open the CTL file we've just created */

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

fpCtl = fopen(szPath, "wb");


/* interpret the SUBMIT file created earlier */

/* to send an existing G3F format file */

ZfxCreateCtlFileFP(hSession, fpSubmit, fpCtl, szBody, "G3F", szDataExtn,  szComment);



/* Create data file in OUT directory */

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



/* submit files */

ZfxSendMsg(hSession, szBody, "G3F", szComment);


Related topics

Alphabetical reference

Function error returns and reference