Difference between revisions of "FCREATE()"

From Recital Documentation Wiki
Jump to: navigation, search
(Class)
Line 1: Line 1:
==Class==
 
ASCII File Access
 
  
  

Revision as of 15:10, 27 October 2009


Purpose

Function to create an ASCII text file


Syntax

FCREATE(<expC>)


See Also

FCLOSE(), FEOF(), FERROR(), FFLUSH(), FGETS(), FOPEN(), FPUTS(), FREAD(), FREADSTR(), FSEEK(), 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