ClientApi::SetUser( const StrPtr * )

Sets the user for this connection.

Virtual?

No

 

Class

ClientApi

 

Arguments

const StrPtr *c

the new user name setting

Returns

void

 

Notes

SetUser() does not permanently set the P4USER value in the environment or registry. Calling this method is equivalent to using the "-u" global option from the command line to set the user value for a single command, with the exception that a single ClientApi object can be used to invoke multiple commands in a row.

If the user setting is to be in effect for the command when it is executed, you must call SetUser() before calling Run().

Example

The following example displays two user specifications by calling SetUser() between Run() commands.

ClientApi client;
Error e;
StrBuf sb1;
StrBuf sb2;

sb1 = "user1";
sb2 = "user2";

char *args[1];
args[0] = "-o";

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

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