Thread: Save integer variable

  1. #1
    Registered User
    Join Date
    Jan 2006
    Location
    Maryland
    Posts
    13

    Talking Save integer variable

    Hi all,

    I'm a beginning level programmer (hobbist) and I would appreciate if someone could give me a clue on a method to save a value from a variable. I would like to update the value during program run time and then on the next time usage of the program have an updated value to use and update again.

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Write the variable to a file. Read the variable back from the file next time you run the program.

  3. #3
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    869
    And it would be more portable and readable to write it out in a text representation.

  4. #4
    Registered User
    Join Date
    Jan 2006
    Location
    Maryland
    Posts
    13
    Thanks guys for the direction on this question, I looked it up in a couple of resources and it looks like that should help with the code. So for now read, write and test what I've got, and again thanks for the swift response.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What does it mean when a integer variable has a word value
    By Nathan the noob in forum C++ Programming
    Replies: 2
    Last Post: 06-26-2008, 02:44 AM
  2. A pointer question.
    By joenching in forum C++ Programming
    Replies: 7
    Last Post: 03-20-2008, 04:10 PM
  3. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. Can I save a variable in a new file?
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-13-2001, 02:30 PM