[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 XMOCHECK()
 Tests a received XMODEM block
------------------------------------------------------------------------------
 Syntax

     XMOCHECK(<cString>,[<lCRC>]) --> nBlockNumber

 Arguments

     <cString>  Designates a character string that is reviewed to
     determine if it represents a valid XMODEM block.

     <lCRC>  Designates whether to check for a checksum (.F.) or a CRC
     (.T.).  The default value (.F.) tests for a checksum.

 Returns

     XMOCHECK() returns the block number for the <cString> transferred by an
     XMODEM block.  The function returns a value between 0 and 255, or
     returns -1 if the block had errors.

 Description

     XMOCHECK() checks a received XMODEM block for errors.  The block header
     is checked, and depending on the way the <lCRC> parameter has been set,
     XMOCHECK() tests the checksum or the CRC.  The function then returns the
     block number as a value between 0 and 255.  If there were inaccuracies
     in the block, -1 is returned.  The standard XMODEM blocks (128 byte
     blocks) and the 1k blocks are recognized on the first character
     automatically.  The header of a 128 byte block starts with CHR(1).   The
     header of a 1k block starts with CHR(2).

 Notes

     .  "Unpacking" the data after checking the block for accuracy is
        very simple using SUBSTR(cBlock, 4, 128) for 128 byte blocks or
        SUBSTR(cBlock, 4, 1024) for 1k blocks.

     .  There is an example for the programming of an XMODEM protocol
        in Xmodem.prg in the samples directory.

 Example

     In this example, the block is received and unpacked.  Test to see if the
     following block has been received:

     cBlock  := COM_READ(1)               // If 132 characters
     nBlkNr  := XMOCHECK(cBlock)          // Test with checksum

     IF nBlkNr >= 0
     cData  := SUBSTR(cBlock, 4, 128)     // Extract data
        * ...
     ENDIF


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