Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

C/C++ API Documentation | 2025.1

# ClientApi::GetCwd()

Get current working directory.

Virtual? | No |
Class | `ClientApi` |
Arguments | None |
Returns | `const StrPtr &` | a reference to the name of the current directory

## Notes

See `GetClient()` for more about the `StrPtr` return value.

If the working directory has been set by a call to `SetCwd()` or `SetCwdNoReload()`, subsequent calls to `GetCwd()` return that setting regardless of the actual working directory.

## Example

The following example demonstrates the usage of `GetCwd()`.

    ClientApi client;

    printf( "Current directory is %s\n", client.GetCwd().Text() );

Executing the preceding code produces the following output:

    C:\perforce> a.out
    Current directory is c:\perforce

Your search for returned results