MAINSAIL Language Manual, Section 36.21

previous   next   top   contents   index   framed top   this page unframed


36.21. $gotValue

Figure 36–19. $gotValue
BOOLEAN
<
macro>     $gotValue       (POINTER(filef);

$gotValue returns TRUE if the last read from the file f returned a value; i.e., if end-of-file was not encountered during the last read from the file f.

$gotValue is a less ambiguous (and more efficient) test for end-of-file than eof. $gotValue returns FALSE only when a read is attempted beyond end-of-file; eof may return TRUE either when a read is attempted beyond end-of-file or immediately before such a read is attempted.

It is often a good idea to design file formats that indicate their own end-of-file, e.g., by some special data value, instead of relying on eof or $gotValue. Some devices do not have an end-of-file.

$gotValue may become TRUE or FALSE after a call to the textFile or dataFile form of read. It is not affected by other input PROCEDUREs (even if end-of-file is encountered) since those PROCEDUREs (which include fldRead, cRead, scan, $storageUnitRead, and $pageRead) return a distinctive value when they encounter end-of-file.


previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Language Manual, Section 36.21