Read external file from compiled application

1 view (last 30 days)
Sieghard
Sieghard on 11 Sep 2019
Dear Matlab experts,
I have another issue with a deployed program. I want to add a license file that needs to be recurringly updated such that after a certain amount of time, the program won't work any more (at least not without some extra hacking), in this case my_program.lic. Thus, I want to read a sequence of numbers from an external tab delimited file that corresponds to an (AES-encoded) expiration date.
The code
function my_program
license_filename = 'my_program';
try
licensefile = dlmread([license_filename '.lic'],'\t');
catch
msgbox('No valid license file was found.','Error','Error');
return
end
% decrypt licensefile, check currency of license, load program
end
works fine as long as I am working out of Matlab. The (kind of silly) syntax with
dlmread([license_filename '.lic'],'\t');
has the background that I naturally don't want the data in the original license file to be included in the compiled program (automatic dependency analysis).
After compilation, the folder of the executable contains the following files:
  • my_icon.ico for the program icon,
  • my_program.lic as license file,
  • my_program.exe as executable of the main program,
  • readme.txt, and
  • splash.png.
Nevertheless, the compiled program cannot read the license file, the error message "No valid license file was found." is displayed and the execution is stopped.
I'd be very happy if somebody could point me to a solution!
Kind regards!

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!