Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- RLIB 3.0a Reference - <b>function:</b> feof() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function:    FEOF()

Purpose:     Test for the End Of File status on a binary file.

Syntax:      FEOF( handle )

Arguments:   handle      - The numeric file handled returned by a previous
                           call to FOPEN() or FCREATE().  If omitted or a
                           non-numeric parameter is passed, FEOF() will
                           return True.

Returns:     True if the current file pointer is at EOF, false otherwise.

Description: FEOF() is a low level file function used to test if a binary
             file opened with FOPEN() or FCREATE() is at the end of file.
             It is written in Clipper (as are all RLIB functions) which
             further illustrates that you do not need assembler or C
             experience to accomplish this task.

Notes:       Assumes the file to be tested has already been opened with
             the FOPEN() or FCREATE() function.  If the file is not open
             (an invalid handle is supplied) FEOF will return True.

             If the file handle is omitted or is non-numeric, FOEF() will
             return True and set RLIBERROR().

Example:     *-- read in CONFIG.SYS into a single field database file
             DECLARE structure[1]
             structure[1] = "LINE       C  80  0"      && define structure

             IF .NOT. DBFCREATE("test.dbf",structure)  && create .DBF file
                BUZZ()
                SAYINBOX("W+/R", "Error creating TEST.DBF", 30)
                RETURN
             ENDIF
             handle = FOPEN("c:\config.sys")           && open CONFIG.SYS
             IF FERROR() != 0
                ? "Error opening c:\config.sys"
                RETURN
             ENDIF
             USE test                                  && open database
             DO WHILE .NOT.  FEOF(handle)              && read in lines
                APPEND BLANK
                REPLACE line WITH FREADLINE(handle)
             ENDDO

             *-- now do whatever with config.sys lines
             *-- perhaps look for the PATH, etc...
             FCLOSE(handle)                            && close up shop
             USE

Source:      RL_FEOF.PRG

See also:    FILEDATE(), FILESIZE(), FILETIME(), FREADLINE()

See Also: FILEDATE() FILESIZE() FILETIME() FREADLINE()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson