top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

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

+4 votes
87 views

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

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...