I'm using the Reprise RLM license manager researching internet activation. I can't figure out how to get the license file from the webserver into a text file with C# (I'm also very new to C#).
RLM comes with an example in C++ but I can't translate it.
My code (for the demo) looks like so:
int stat = RLM.rlm_act_request(handle, "http://www.reprisesoftware.com", "rlmactdemo", activationKey, "", "", 1, "", new byte[RLM.RLM_MAX_LINE+1]);
if (stat == 0||stat == 1){
//Successful connection
//Read license file and write to local machine
}
rlm_act_request
establishes and verifies the connection. Once it is established, how do I access the file and write it a local file?
EDIT:
The C++ code for whatever goes in that if statement is as follows:
char name[100];
char license[100];
int try;
FILE *f, *fopen();
stat = 1;
for (try=0; try<100; try++)
{
sprintf(name, "a%d.lic", try);
f = fopen(name, "r");
if (f == (FILE *) NULL)
{
f = fopen(name, "w");
if (f)
{
fprintf(f, "%s\n", license);
fclose(f);
break;
}
else
{
printf("Error writing license file \"%s\"\n", name);
stat = -1;
break;
}
}
}
What's the C# equivalent?