ClientApi::Init( Error * )

Establish a connection and prepare to run commands.

Virtual?

No

 

Class

ClientApi

 

Arguments

Error *e

an Error object

Returns

void

 

Notes

Init() must be called to establish a connection before any commands can be sent to the server. Each call to Init() must be followed by exactly one call to Final().

If an error occurs during Init(), it is most likely a connection error, with a severity of E_FATAL.

Example

The following code from p4api.cc opens a connection with Init(), sets arguments, runs a command, and closes the connection with Final().

ClientUser ui;
ClientApi client;
Error e;

client.Init( &e );

client.SetArgv( argc - 2, argv + 2 );
client.Run( argv[1], &ui );
client.Final( &e );
return 0;