Thread: Saving variables within a compiled exe?

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    10

    Saving variables within a compiled exe?

    Hi,

    Is it possible to write variables directly into the main ".exe" file, so that when the program is next run, it still remembers what the variables were last set to?

    I imagine that this is normally done using .dat files, or text files, or even registry entries, but is it possible to do within the ".exe" itself?

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    What operating system? Under Windows, you can use the BeginUpdateResource/UpdateResource/EndUpdateResource API's. Of course you have to have an existing resource section in the executable for those to work.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    You asked already....
    modifying and saving global variables on a executable file using libelf !!!!

    What have YOU done so far.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating local variables in a program?
    By fl0at in forum C Programming
    Replies: 5
    Last Post: 01-04-2008, 07:34 PM
  2. Global Variables
    By Taka in forum C Programming
    Replies: 34
    Last Post: 11-02-2007, 03:25 AM
  3. Reading Separate Digits as Variables
    By linuxpyro in forum C Programming
    Replies: 7
    Last Post: 09-13-2006, 05:23 PM
  4. saving mutliple variables.......
    By jverkoey in forum C++ Programming
    Replies: 10
    Last Post: 02-13-2003, 08:34 PM
  5. functions to return 2 variables?
    By tim in forum C Programming
    Replies: 5
    Last Post: 02-18-2002, 02:39 PM