FCREATE()

From Recital Documentation Wiki
Revision as of 13:48, 2 June 2009 by Yvonnemilne (Talk | contribs)

Jump to: navigation, search

Class

ASCII File Access


Purpose

Function to create an ASCII text file


Syntax

FCREATE(<expC>)


See Also

FCLOSE(), FERROR(), FGETS(), FOPEN(), FPUTS(), FREADSTR(), FWRITE(), MEMOREAD(), MEMOWRITE(), TEXTEDIT()


Description

The FCREATE() function will create a new ASCII text file or truncate an existing file to zero length. The <expC> is the name of the file to be created. When FCREATE() successfully creates a new file it leaves the file open and returns the numeric file pointer. If an error occurs, FCREATE() returns a file pointer with a value of -1. Since the file pointer is required in order to identify an open file to other file functions, always assign the return value to a memory variable. If an error occurs during the operation, -1 is returned by the FERROR() function.


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