CT_DISKCHECK

 DISKCHECK()
 Creates a checksum for a disk

 Syntax

     DISKCHECK(<cDrive>, [<nStartSector>]) --> nCheckSum

 Arguments

     <cDrive>   Designates which drive (A, B, C, etc.) you want to check.

     <nStartSector>  Designates a sector to serve as a starting point to
     check the disk in the direction of the first sector.

 Returns

     DISKCHECK() returns a number that corresponds to a checksum for the data
     carrier in <cDrive>.  If read errors occur, the function returns a
     negative number when the first bad sector is found.

 Description

     DISKCKECK() begins its check with the last sector of the designated
     drive or with the <nStartSector> value, and works in the direction of
     the first sector.  If a sector is found to contain errors, then it
     returns a negative value.

     If it returns a -1, continue to check for other errors (such as a
     missing disk).  The CA-Clipper Tools function ERRORCODE() is quite
     useful here.  Error code returns a value that symbolizes the most-recent
     DOS error.

     Since DISKCHECK() returns a checksum, it is easy to check for disk
     changes.

 Note

     .  You must specify the <cDrive> parameter.  If you omit it or
        specify an unavailable drive, DISKCHECK() returns an error code of -
        1.  DISKCHECK() takes more time to check a hard disk.

 Examples

     .  Create a checksum for a floppy:

        Checksum  :=  DISKCHECK("A")

     .  Show that the disks are changed:

        IF DISKCHECK("A") == Checksum
           ? "You have not changed disks!"
        ENDIF

See Also: FILECHECK() ERRORCODE()

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.