FERROR()

From Recital Documentation Wiki
Revision as of 17:22, 27 November 2009 by Helengeorge (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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


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


Products

Recital Server, Recital