![]() |
|
Use this task to add code to the source file for a CORBA client, to check input parameters. This code is used to check the parameters that a user specifies when starting the CORBA client.
This task is one step of the parent task to create the CORBA client main code, as described in Creating a CORBA client main code (client.cpp).
This examples in this task are based on a CORBA client that is started by the following command:
client log_file_name iterationsWhere:
The code checks that the command used to start the CORBA client specifies two arguments required.
To add code to check the input parameters to the source file for a CORBA client main code, complete the following steps::
main(int argc, char *argv[]) { int rc; ::CORBA::Object_ptr objPtr; ::CosNaming::NamingContext_var rootNameContext = NULL; servant_var liptr = NULL; if ( argc != 3 ) { cerr << "Usage: client <log_file_name> <iterations>" << endl; exit( -1 ); } else { cout << "Entered client with log file name = " << argv[1]; cout << " and iteration count = " << argv[2] << endl; } if ( ( rc = perform_initialization( argc, argv ) ) != 0 ) exit( rc );
Where the client program name and arguments are as specified above.
This task adds code to check input parameters to the main method in the source file for a CORBA client.
You need to add code to the client source file to initialize the client environment, as described in Creating a CORBA client main code (client.cpp), adding code to initialize the client environment.
![]() |