# cdir¶

## Purpose¶

Returns the current directory.

## Format¶

dir = cdir(s)
Parameters: s (string, or scalar) – A null string, or a scalar 0. dir (string) – containing the drive and full path name of the current directory on the specified drive.

## Examples¶

### Windows Example¶

If the current working directory is C:\gauss:

// Get current directory
dir = cdir(0);


After the code above, dir will equal:

C:\gauss


### macOS Example¶

If the current working directory is /Users/Research/gauss:

// Get current directory
dir = cdir(0);


After the code above, dir will equal:

/Users/Research/gauss


## Remarks¶

If the current directory is the root directory, the returned string will end with a backslash, otherwise it will not.

A null string or scalar zero can be passed in as an argument to obtain the current drive and path name.