Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

The

...

following

...

code

...

snippet

...

gives

...

an

...

example

...

of

...

how

...

to use

...

the

...

LAC

...

end-user

...

C

...

API

...

calls

...

to

...

create

...

a

...

license

...

request

...

and

...

retrieve

...

the

...

generated license automatically.

Code Block
#include <stdio.h>
#include <windows.h>

 license automatically.

\#include "lac.h"
...

 
int main()
{
  LAC_STATUS LacStat;

  char szResponse\[LAC_MAX_RESPONSE_LENGTH\] = \{0\};
 
  const char \*szActivationKey = "9EFJK-TVJM0-MCDET-EZKXJ";
  const char \*szHostid = "HOSTNAME=my_hostname";
  const char \*szUrl = "http://license.x-formation.com/soap/type/enduser/version/1";
 
  if ((LacStat = LAC_CreateLicenseRequest(szActivationKey, szHostid, szUrl, NULL, 0, NULL, NULL, szResponse)) \!= LAC_SUCCESS)
  {
&nbsp; printf(    fprintf(stderr, "Error code: %d\n", LacStat);
&nbsp;    
    if (strlen(szErrorszResponse) > 0)
&nbsp; &nbsp; printf(
    {
      fprintf(stderr, "Error message: %s\n", szResponse);
&nbsp;
    }
    
    return 1;
  }
 
  do
  {
&nbsp;    LacStat = LAC_GetLicense(szActivationKey, szHostid, szUrl, NULL, 0, NULL, NULL, szResponse);
 
    if (LacStat == LAC_SUCCESS)

&nbsp;     {
      break;
    }
    else if (LacStat \!= LAC_PLEASE_WAIT)
&nbsp;    {
&nbsp; &nbsp; printf(      fprintf(stderr, "Error code: %d\n", LacStat);
&nbsp; &nbsp;      
      if (strlen(szErrorszResponse) > 0)
&nbsp; &nbsp; &nbsp; printf(      {
        fprintf(stderr, "Error message: %s\n", szResponse);
&nbsp; &nbsp;
      }
      
      return 1;
&nbsp;    }

&nbsp; 
    Sleep(2000);
  }
  while (LacStat \!= LAC_SUCCESS);
 
  printf("License:\n\n%s\n", szResponse);
 
  return 0;
}