Add Resources to C Program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • animeprogrammer
    New Member
    • Jan 2014
    • 13

    Add Resources to C Program

    Hello there, can I guys ask a serious question....

    Is it possible to have a data-type that does not change when the program exits... Sample:

    A boolean type data is false, then it became true i closed the program and open it again. So the boolean-type should be true again..

    IS THIS POSSIBLE? :D thanks

    Regards,
    AnimeProgrammer
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Yes it is.

    One way (and the easiest) is to create a file that can be read when the program starts so you can set various values. This file can be updated when the program stops. If this is a text file then you can read the values easily with a text editor.

    Another way is to run your program as a worker thread and keep the values as part of the main thread.

    A variation on this would be to start a process which itself starts a second process (your program) and provide the necessary values.

    Comment

    • animeprogrammer
      New Member
      • Jan 2014
      • 13

      #3
      can I see examples, because its kind of hard when you say it. How do i do that?

      Any answer is highly respected and appreciated.

      Thanks

      Regards,
      AnimeProgrammer

      Comment

      Working...