ILOG CPLEX 11.0 User's Manual > Programming Considerations > Licensing an Application > Examples > CPXRegisterLicense Routine for C and C++ Users

The following is an example showing how to use the routine CPXRegisterLicense.

static char *ilm_license=\
 "LICENSE ILOG Incline\n\
  RUNTIME CPLEX 9.200 21-Jul-2005 R81GM34ECZTS N , options: m ";
static int ilm_license_signature=2756133;

   CPXENVptr     env = NULL;
   int           status;

   /* Initialize the CPLEX environment */

    status = CPXRegisterLicense (ilm_license, ilm_license_signature);
    if ( status != 0) {
       fprintf (stderr, "Could not register CPLEX license, status %d.\n",
                status);
       goto TERMINATE;
    }
    env = CPXopenCPLEX (&status);
    if ( env == NULL ) {
       char  errmsg[1024];
       fprintf (stderr, "Could not open CPLEX environment.\n");
       CPXgeterrorstring (env, status, errmsg);
       fprintf (stderr, "%s", errmsg);
       goto TERMINATE;
    }