top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Is there any provision in C that generated binary can't be run after a fixed number of times.

+4 votes

Suppose a programmer wants that generated binary of C program should not work after a fixed number of times(like 5 times).

posted Sep 18, 2013 by Neeraj Mishra

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

There are many ways to achieve this, simplest way could be -
1. Lets say your program is dependent on a file.
2. Everytime program runs it first read the value of the file (if file is not there then create the file and write the content as "1"), if it is less then 5 (say n) then increase the value by 1 and rewrite this in the file.
3. If it is more then 5 (say n) then exit.

There can be other ways also on the similar lines, or there can be a wrapper script also.

answer Sep 18, 2013 by Salil Agrawal
Similar Questions
+4 votes

"Given an array of strings, find the string which is made up of maximum number of other strings contained in the same array. e.g. “rat”, ”cat”, “abc”, “xyz”, “abcxyz”, “ratcatabc”, “xyzcatratabc” Answer: “xyzcatratabc”

+3 votes

Looking some suggestions,
My binary size is huge after compilation, i want it get reduced so that loading is faster. Any input?

My Environement
C, Linux and gcc