Jump to content




Saving variables for the next time the computer runs the same program?


  • You cannot reply to this topic
2 replies to this topic

#1 marceloclp

  • Members
  • 10 posts

Posted 03 May 2014 - 10:15 PM

Is there a way to save variables for the next time the computer runs the same program?

Ex: at the end of the program, I have a variable that adds one to itselft. So if the first time I ran the program, its value was 1, the next time, its value will be 2. And so on.

Is there any way I can do this?

#2 OczkoSX

  • Members
  • 29 posts

Posted 03 May 2014 - 10:30 PM

You have to create a file, and save a variable value to it. Read about file streams (fs)

#3 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 04 May 2014 - 01:36 AM

In particular, you'll want to read up on fs.open().





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users