FWRITE()

From Recital Documentation Wiki
Revision as of 14:19, 23 March 2009 by Yvonnemilne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Class

ASCII File Access


Purpose

Function to write a character expression to an ASCII file


Syntax

FWRITE(<expN1>, <expC> [,<expN2>])


See Also

FCLOSE(), FCREATE(), FDATE(), FERROR(), FGETS(), FOPEN(), FREAD(), FREADSTR(), FTIME(), MEMOREAD(), MEMOWRITE(), TEXTEDIT()


Description

The FWRITE() function writes the character expression <expC> to a specified text file. The <expN1> is the file pointer returned by either the FOPEN() or FCREATE() functions. The optional <expN2> specifies the maximum number of bytes to write from the buffer.

The effect of FWRITE() is to write new lines sequentially to the opened text file each time it is used on the file. If an error occurs during the operation -1 is assigned to the FERROR() function. The file pointer must be assigned when the file is first opened using the FOPEN() or FCREATE() functions.


Example

use acc_log
scatter to flist
m_total=alen(flist)
fp=fcreate("new.txt")
if ferror()=-1
    dialog box "The file could not be created."
else
    for n=1 to m_total
        fwrite(fp,flist[n],80)
    next
endif
fclose(fp)
if ferror()=-1
    dialog box "The file could not be closed."
endif


Products

Recital Database Server, Recital Mirage Server, Recital Terminal Developer