DiskChange

DiskChange

Change the current DOS disk drive

Syntax

      DiskChange(<cDrive>) --> lSuccess

Arguments

<cDrive> : specifies the letter of the disk drive to change to

Returns

DiskChange() returns true (.T.) if successful; otherwise, it returns false (.F.).

Examples

      ? DiskName()        // D
      ? DiskChange()      // .F.
      ? DiskChange( "C" ) // .T.
      ? DiskName()        // C

      .  This example uses DiskChange() to change to drive "D":

      IF DiskChange("D:")
         ? "Successfully changed"
      ELSE
         ? "Not changed"
      ENDIF

      .  This example builds a string that contains all currently
         available drives on your system:

       PROCEDURE Main()
           ? DriveList()
           ?
           WAIT "EOF DiskChange.prg"
       RETURN // DiskChange.Main()

       *˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜

       FUNCTION DriveList()

          LOCAL nDriveNo := 0,;
                c1Drive  := '',;
               cRetVal  := "",;
               cCurrent := DiskName()

          FOR nDriveNo := 1 TO 26
             c1Drive := CHR( nDriveNo + 64)
             IF DiskChange( c1Drive )
                cRetVal += c1Drive
             ENDIF
          NEXT

         DiskChange( cCurrent )  // Restore current drive

       RETURN cRetVal // DriveList()

Seealso

DiskName()

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.