Difference between revisions of "FERROR()"
From Lianjapedia
Yvonne.milne (Talk | contribs) m (1 revision) |
Yvonne.milne (Talk | contribs) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
Function to return the status of the last text-file operation | Function to return the status of the last text-file operation | ||
− | |||
==Syntax== | ==Syntax== | ||
FERROR() | FERROR() | ||
− | |||
==See Also== | ==See Also== | ||
− | [[FCLOSE()]], [[FCREATE()]], [[FGETS()]], [[FOPEN()]], [[FPUTS()]], [[FREADSTR()]], [[FWRITE()]], [[MEMOREAD()]], [[MEMOWRITE()]] | + | [[FCLOSE()]], [[FCREATE()]], [[FGETS()]], [[FOPEN()]], [[FPUTS()]], [[FREADSTR()]], [[FWRITE()]], [[MEMOREAD()]], [[MEMOWRITE()]] |
− | + | ||
==Description== | ==Description== | ||
The FERROR() function returns an integer representing the status of the last text file operation. It returns –1 for failure, 0 for success. This function should always be used in conjunction with the other text file functions to check for errors. | The FERROR() function returns an integer representing the status of the last text file operation. It returns –1 for failure, 0 for success. This function should always be used in conjunction with the other text file functions to check for errors. | ||
− | |||
==Example== | ==Example== | ||
Line 35: | Line 31: | ||
</code> | </code> | ||
− | |||
− | |||
− | |||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
− | |||
[[Category:ASCII File Access Functions]] | [[Category:ASCII File Access Functions]] |
Latest revision as of 08:19, 4 February 2013
Contents
Purpose
Function to return the status of the last text-file operation
Syntax
FERROR()
See Also
FCLOSE(), FCREATE(), FGETS(), FOPEN(), FPUTS(), FREADSTR(), FWRITE(), MEMOREAD(), MEMOWRITE()
Description
The FERROR() function returns an integer representing the status of the last text file operation. It returns –1 for failure, 0 for success. This function should always be used in conjunction with the other text file functions to check for errors.
Example
use accounts fp=fopen("existing.file") if ferror()=-1 dialog box "The file could not be opened." else string = freadstr(fp,80) do while not empty(string) ? string string = freadstr(fp,80) enddo ? fclose(fp) if ferror()=-1 dialog box "The file could not be closed." endif endif