Write CGI Buffer to the IFS

cgiWrtFileIFS

The cgiWrtFileIFS procedure copies the text (typically HTML) in the CGI output buffer to a file on the IFS.

The cgiWrtFileIFS procedure writes the output buffer to an IFS file. It does not clear the CGI buffer. The buffer may still be sent to the browser using the cgiFlushBuffer() procedure or it may be abandoned. Typically this procedure is used to review (i.e., debug) your HTML without sending it to the browser.

nBytesWritten   cgiWrtFileIFS(
 szIFSFile             *    VALUE OPTIONS(*STRING)
 bRedirect             N    Const OPTIONS(*NOPASS)
)

See also: cgiWrtSection

Parameters

szIfsFile [optional]
[input Char(*) value]  The name of the IFS file to which the HTML buffer is written. Any IFS file can be specified. If the file does not exist, it will be created. If it already exists, it is replaced.

 

bRedirect  [optional]  DFT('0')
[input Indy(1n) const]  Indicates whether or not the browser is sent a Location: header to point it at the newly created file. This options is rarely useful as browsers use relative directories when referring to files. An absolute directory is what will be sent and therefore will not work. To redirect the browser to the file, create a relative directory reference to the file and send the Location: header yourself. 

The Location: response-header is used to redirect the client's browser to a location other than the Request-URI for completion of the request or identification of a new resource.

The valid choices for this parameter are as follows:

 
 
Options Description
'0' Do not send the Location: header to the browser
'1' Send the Location: header tot he browser.
 

Return Value

The return value is the number of bytes written to the IFS file.

Example

The following sends the HTML in the CGILIB's internal buffer to the file named DEBUG.HTML in the /www/htdocs folder on the IFS.

     /INCLUDE XTOOLS/QCPYSRC,cgi
.....CSRn01..............OpCode(ex)Extended-factor2++++++++++++++++++++++++++++++++

     C                   Eval      cgiWrtFileIFS('/www/htdocs/debug.html')