HB_FNameSplit

HB_FNameSplit()

Splits a full file specification into individual components.

Syntax

      HB_FNameSplit( <cString>      , ;
                     [@<cPath>]     , ;
                     [@<cFileName>] , ;
                     [@<cExtension>]  ) --> NIL

Arguments

<cString> : a character string to split into different components of a file name.

@<cPath> : If specified, <cPath> must be passed by reference. It receives the path component for a file as a character string.

@<cFileName> : If specified, <cFileName> must be passed by reference. It receives the name component for a file as a character string.

@<cExtension> : If specified, <cExtension> must be passed by reference. It receives the file extension as a character string.

Return

This function returns always NIL. The components of a file name are assigned to the parameters passed by reference.

Description

HB_FNameSplit() is used to split a full qualified file name into individual components. They can be merged later with function HB_FNameMerge().

Seealso

CurDir(), CurDrive(), Directory(), File(), HB_FNameMerge()

HB_FNameMerge

HB_FNameMerge()

Composes a full file specification from individual components

Syntax

      HB_FNameMerge( [<cPath>]     , ;
                     [<cFileName>] , ;
                     [<cExtension>]  ) --> cResult

Arguments

<cPath> : a character string holding the path component for a file.

<cFileName> : a character string holding the name component for the file.

<Extension> : a character string holding the file extension.

Return

This function returns a character string containing all components passed to the function. When no parameter is passed, an empty string (“”) is returned.

Description

HB_FNameMerge() is used to build a full qualified file name from individual components. They can be obtained by calling HB_FNameSplit().

Seealso

CurDir(), CurDrive(), Directory(), File(), HB_FNameSplit()

DiskName

DiskName

Return the current OS drive

Syntax

      DiskName() --> cDrive

Returns

DiskName() returns the letter of the current DOS drive, without a trailing colon.

Examples

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

      .  This example illustrates the relationship between
         DiskName()and DISKCHANGE() and shows that DiskName() is unaffected by
         the SET DEFAULT TO command:

      ? DiskName()      // C
      SET DEFAULT TO A
      ? DiskName()      // C
      DISKCHANGE("A")
      ? DiskName()      // A
      DISKCHANGE("C")
      ? DiskName()      // C

Seealso

CurDir(), DiskChange()

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()