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

C/C++ API Documentation | 2026.1

# ClientApi::SetVersion( const StrPtr * )

Sets the application or script version for this connection.

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

## Notes

`SetVersion()` sets the version number of a client application as reported by the `p4 monitor -e` command, or as recorded by server logging.

If a client application compiled with version 2005.2 or later of the API does not call SetVersion(), then the version string reported by p4 monitor -e (and recorded in the server log) defaults to the api value appropriate for the server level as per SetProtocol().

Call `SetVersion()` after calling `Init()` and before each call to `Run()`.

## See also

- `ClientApi::SetProtocol()`

- `ClientApi::SetProg()`

## Example

The following example appears as `2005.2` in the output of `p4 monitor show -e`.

    ClientApi client;
    ClientUser ui;
    StrBuf sb;
    Error e;

    sb.Set( "2005.2" );

    client.Init( &e );
    client.SetVersion( &sb );
    client.Run( "info", &ui );

Your search for returned results