Difference between revisions of "FCREATE()"

From Lianjapedia
Jump to: navigation, search
m (1 revision)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Function to create an ASCII text file
 
Function to create an ASCII text file
 
  
 
==Syntax==
 
==Syntax==
 
FCREATE(<expC>)
 
FCREATE(<expC>)
 
  
 
==See Also==
 
==See Also==
[[FCLOSE()]], [[FEOF()]], [[FERROR()]], [[FFLUSH()]], [[FGETS()]], [[FOPEN()]], [[FPUTS()]], [[FREAD()]], [[FREADSTR()]], [[FSEEK()]], [[FWRITE()]], [[MEMOREAD()]], [[MEMOWRITE()]], [[TEXTEDIT()]]
+
[[FCLOSE()]], [[FEOF()]], [[FERROR()]], [[FFLUSH()]], [[FGETS()]], [[FOPEN()]], [[FPUTS()]], [[FREAD()]], [[FREADSTR()]], [[FSEEK()]], [[FWRITE()]], [[MEMOREAD()]], [[MEMOWRITE()]]
 
+
  
 
==Description==
 
==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.
 
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==
 
==Example==
Line 34: Line 30:
 
</code>
 
</code>
  
 
==Products==
 
Recital Server, Recital
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:ASCII File Access]]
 
[[Category:ASCII File Access]]
 
[[Category:ASCII File Access Functions]]
 
[[Category:ASCII File Access Functions]]

Revision as of 07:58, 25 November 2011

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()

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