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 - meof() determine if a memo is at the eof http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 meof()              Determine if a memo is at the EOF
------------------------------------------------------------------------------
 Declaration
   memo.hdr

 Syntax
   func logical meof extern
   param memo mMemoField

 Arguments
   mMemoField is the memo to operate on.

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

 Description
   The meof() function returns .t. if the current memo read/write pointer
   is at the end of mMemoField.

 Example
   #define EXAMPLE_DATABASE
   #include example.hdr

   func char MemoSearch
   param memo mfield, const char cSearch
   // Search a memo file for a certain string
   vardef
      char    cMemoLine
      logical lFound
   enddef
   lFound := .f.
   mopen( mfield, MO_READ )
   do while .not. meof( mfield )   // search through memo file
      mgetln( mfield, cMemoLine )  // read a line
      if cSearch $ cMemoLine       // compare to search string
         lFound := .t.
         exit
      endif
   enddo
   mclose( mfield )
   if .not. lFound
      cMemoLine := ""
   endif
   return( cMemoLine )
   endproc
   
   proc Test_meof
   open sTest
   go 50
   mopen( sTest->notes, MO_APPEND )
   mputln( sTest->notes, "Customer name" )
   mputln( sTest->notes, ">" + sTest->lastname )       // write to memo
   mclose( sTest->notes )
   ? sTest->lastname                                   // prints search name
   ? MemoSearch( sTest->notes, ">" + sTest->lastname ) // prints result
   endproc

   proc main
   Test_meof()
   endproc

See Also: mgetln()

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