[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
    fbRead()

         Reads bytes from a binary file

    Syntax:

         fbRead( nHandle, cBuffer, nBuffer, nRead, ;
                 cFile, lForce ) -> lExit

         nHandle : The file handle of the file.
         cBuffer : The buffer to fill.
         nBuffer : The number of bytes to read.
         nRead   : Variable that returns the number of bytes read.
         cFile   : The name of the file.
         lForce  : Logic value to force nBuffer to be the same value
                   as nRead.

    Description:

         Reads nBuffer bytes from the file (nHandle/cFile) depositing the
         result in cBuffer. If cBuffer isn't big enough, the function will
         fill it with spaces at the end.  cFile is used to allow error
         messages to be displayed. If lForce is .T. the value read from the
         file must be nBuffer bytes and doesn't return until nRead is equal
         to that amount.  If lForce is .F. the function returns even though
         the value nRead hasn't been reached. Forget retries cause the
         same function checks all of that.

    Return:

         If there's some error, returns .F. if not returns .T.

    Example:

         cFile     := "Fast.txt"
         nHand     := fbOpen ( cFile, 0 )
         nRead     := 0
         nBuffer   := 100
         cBuffer   := Space ( nBuffer )
         lForce    := .F.
         If ! fbRead( nHand, cBuffer, nBuffer, @nRead, cFile, lForce )
           BoxWarning ( "The reading has been unsuccessful" )
         Else
           BoxWarning ( "I've read " + Str ( nRead ) + " Bytes" )
         EndIf
         fbClose ( { nHand } )

See Also: fbOpen() fbClose() fbCreate() fbWrite()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson