#include <stdio.h>
#include <stdlib.h>
#define NUM_OF_LICENSES 1
char* license_key_ring[NUM_OF_LICENSES];
FILE *license_file = fopen(license_file_path, "rb" );
if( !license_file ) {
printf("License not found!\n");
return;
}
fseek(license_file, 0, SEEK_END);
size_t file_size = (size_t)ftell(license_file);
rewind(license_file);
if(file_size <= 0) {
printf("License is empty!\n");
return;
}
license_key_ring[0] = (char*)malloc(file_size);
if(license_key_ring[0]) {
size_t read_bytes = fread( license_key_ring[0], sizeof(char), file_size, license_file );
if (file_size != read_bytes) {
printf("Failed to read license file!\n");
return;
}
}
fclose(license_file);
printf("Applying license from %s.\n", license_file_path);
free(license_key_ring[0]);
printf("Successfully applied license from list of keys.\n");
}
}