Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - aeof() determine if end of file is encountered in alias http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 aeof()              Determine if end of file is encountered in alias
------------------------------------------------------------------------------
 Declaration
   database.hdr

 Syntax
   func logical aeof extern
   param alias sDatabase

 Arguments
   sDatabase is the alias to retrieve information about.

 Return
   A logical indicating if the record pointer is at the end of file.

 Description
   The aeof() function returns .t. if the record pointer has been positioned
   past the last logical record in the specified alias sDatabase. Use
   the aeof() function to detect the end of a database in a do while loop
   to skip through the database, or if a seek is attempted.

   The aeof() function performs identically to the eof() function. aeof()
   differs syntactically in that it accepts an alias as a parameter.

   Use aeof() when your application has more than one database open at one
   time. The aeof() function eliminates the need to manage the current
   workarea.

   Note that in case aeof() returns .t., the record pointer actually points
   to a "ghost record" past the last logical record in the database file,
   i.e. may be necessary to re-position the record pointer to a valid record,
   e.g. to the last record by issuing a go bottom, or a skip -1 command.

 Example
   #define EXAMPLE_DATABASE
   #include example.hdr

   proc Test_aeof
   open "stest.dbf" alias sTest
   
   !sTest goto 90
   
   // Display the remaining records up to the end of the database
   do while .not. aeof( sTest )
      ? sTest->firstname, sTest->lastname
      // Never forget the skip command, or you will end up in a
      // loop forever !
      !sTest skip
   enddo
   
   // Some experiments around the end of file...
   ?
   !sTest go bottom
   ? "aeof() on the last record returns:               ", aeof( sTest )
   !sTest skip
   ? "After another skip, aeof() returns:              ", aeof( sTest )
   ? "Here, the lastname field contains:                '" + ;
       sTest->lastname + "'"
   sTest->lastname := "Testname"
   ? "After assigning a value, the field still contains '" + ;
      sTest->lastname + "'"
   !sTest skip -1
   ? "After skip -1, aeof() returns:                   ", aeof( sTest )
   ? "Here, the lastname field contains:                '" + ;
      sTest->lastname + "'"
   endproc

   proc main
   Test_aeof()
   endproc

See Also: abof() eof()

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