Difference between revisions of "FWRITE()"
Yvonne.milne (Talk | contribs) m (1 revision) |
Yvonne.milne (Talk | contribs) |
||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
Function to write a character expression to an ASCII file | Function to write a character expression to an ASCII file | ||
− | |||
==Syntax== | ==Syntax== | ||
FWRITE(<expN1>, <expC>[, <expN2>]) | FWRITE(<expN1>, <expC>[, <expN2>]) | ||
− | |||
==See Also== | ==See Also== | ||
− | [[FCLOSE()]], [[FCREATE()]], [[FDATE()]], [[FERROR()]], [[FGETS()]], [[FOPEN()]], [[FPUTS()]], [[FREAD()]], [[FREADSTR()]], [[FTIME()]], [[MEMOREAD()]], [[MEMOWRITE()]] | + | [[FCLOSE()]], [[FCREATE()]], [[FDATE()]], [[FERROR()]], [[FGETS()]], [[FOPEN()]], [[FPUTS()]], [[FREAD()]], [[FREADSTR()]], [[FTIME()]], [[MEMOREAD()]], [[MEMOWRITE()]] |
− | + | ||
==Description== | ==Description== | ||
Line 15: | Line 12: | ||
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. FWRITE() does not include line terminators when writing to the file; this can be achieved using [[FPUTS()]]. | 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. FWRITE() does not include line terminators when writing to the file; this can be achieved using [[FPUTS()]]. | ||
− | |||
==Example== | ==Example== | ||
Line 31: | Line 27: | ||
</code> | </code> | ||
− | |||
− | |||
− | |||
[[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 06:38, 10 February 2012
Contents
Purpose
Function to write a character expression to an ASCII file
Syntax
FWRITE(<expN1>, <expC>[, <expN2>])
See Also
FCLOSE(), FCREATE(), FDATE(), FERROR(), FGETS(), FOPEN(), FPUTS(), FREAD(), FREADSTR(), FTIME(), MEMOREAD(), MEMOWRITE()
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.
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. FWRITE() does not include line terminators when writing to the file; this can be achieved using FPUTS().
Example
fp=fcreate("time.txt") if ferror()=-1 dialog box "The file could not be created." else fwrite(fp,timestamp()) endif fclose(fp) if ferror()=-1 dialog box "The file could not be closed." endif