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

C/C++ API Documentation | 2025.1

# ClientApi::GetOs()

Get name of client operating system.

Virtual? | No |
Class | `ClientApi` |
Arguments | None |
Returns | `const StrPtr &` | a reference to the OS string

## Notes

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

`GetOs()` returns one of “UNIX”, “vms”, “NT”, “Mac”, or null.

## Example

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

    ClientApi client;
    printf( "Client OS is %s\n", client.GetOs().Text() );

Executing the preceding code under Windows produces the following output:

    C:\perforce> a.out
    Client OS is NT

Executing the preceding code on a UNIX machine produces the following output:

    shire$ a.out
    Client OS is UNIX

Your search for returned results