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

C/C++ API Documentation | 2026.1

# ClientApi::SetPassword( const char * )

Sets the password to be used for this connection.

Virtual? | No | Class
`ClientApi` |  | Arguments
`const char *c` | the new password value | Returns

## Notes

`SetPassword()` does not permanently change the `P4PASSWD` value in the environment, nor does it in any way change the password that has been set on the server. The new setting applies only to authentication attempts for commands executed by calling this `ClientApi` object’s `Run()` method.

## Example

The following trivial example demonstrates how to hard-code a password into an application without making it (immediately) user-visible.

    ClientApi client;
    ClientUser ui;

    client.SetPassword( "p455w04d" );
    client.SetArgv( argc - 2, argv + 2 );
    client.Run( argv[1], &ui );

Your search for returned results