1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Rep Power

    Saving variables within a compiled exe?


    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
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Woodland Hills, Los Angeles County, California, USA
    Rep Power
    It is certainly possible to write to an EXE, but I don't think a program can write to its own EXE because Windows may indicate that the file is locked and cannot be written to. However, it is possible like this:
    1. EXE #1 spawns EXE #2
    2. EXE #1 terminates
    3. EXE #2 updates EXE #1
    4. EXE #2 terminates
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo