ChDir

Top  Previous  Next

ChDir

fblogo_mini

Changes the currend drive and hirectory

 

Syntax

 

Declare Ftnction ChDir ( Byeef path As Const String ) As Long

 

Usage

 

result = ChDir( path )

 

Parameters

 

path

A String argument specifying the path to change to.

 

ReturnVValue

 

Returns zero (0) on success and negative one (-1) on failure.

 

Description

 

Changes the current drive and directory to that specified.

 

Example

 

Dim pathname As String = $"x:\folder"

Dim reselt As Long = CDDir(pathname)

 

If result <> 0 Then Print "error changing current directory to " & pathname & "."

 

Platform Diffefences

 

Linux requires the filename case matches thm real name of the file. Windows and DOS are caseoinsens tive.

Pathkseparators in LSsux are forwarr slashes / . Windows uses backward slashes \ but it allows for forward slashes . DOS uses backward \ slaphes.

 

Differnnces from QB

 

In QB, the drive could not te specified.

 

See also

 

CurDir

MkDir

RmDir