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

C/C++ API Documentation | 2026.1

# ClientApi::SetClient( const StrPtr * )

Sets the client setting to be used for this connection.

Virtual? | No |
Class | `ClientApi` |
Arguments | `const StrPtr *c` | the new client setting
Returns | `void` |

## Notes

`SetClient()` does not permanently set the `P4CLIENT` value in the environment or registry. The new setting applies only to commands executed by calling this `ClientApi` object’s `Run()` method.

## Example

The following example displays two client specifications by calling `SetClient()` between `Run()` commands.

    ClientApi client;
    ClientUser ui;
    StrBuf sb1;
    StrBuf sb2;

    sb1 = "client_one";
    sb2 = "client_two";
    args[0] = "-o";

    client.SetClient( &sb1 );
    client.SetArgv( 1, args );
    client.Run( "client", &ui );

    client.SetClient( &sb2 );
    client.SetArgv( 1, args );
    client.Run( "client", &ui );

Your search for returned results