Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Saving a variable correctly

Author
Message
Mr Black
18
Years of Service
User Offline
Joined: 20th Oct 2005
Location: USA
Posted: 20th May 2006 02:52 Edited at: 20th May 2006 13:55
This is probably exremely noobish, and i DID try searching, didnt find what i needed tho. I want my variable to correctly save to a file. Its just a single digit number that tells how many files are in a folder, when you make one it adds 1 to my variable, which it does do, i made it print the variable afterwards so i know it does and i know it goes to my save label.

When i exit the program and go back the variable is always 1 or 0 and i hate it. Below is the source code that saves and loads the data.

Kivu_Rako
20
Years of Service
User Offline
Joined: 10th May 2004
Location:
Posted: 20th May 2006 06:25 Edited at: 20th May 2006 06:26
well lets see here.... what im seeing is two variables, var and t... im not sure if you are trying to save var or t, my instincts told me you accidently put t instead of var, but assuming you are not that noobish, i will try to help assuming t is correct...

for one you are not deleting a file called file.txt if it exists, which means the code will fail... i also recommend gosubs but i wont go there...

i hope that helps, if there is another problem let me know.

To call the French scumbags would be a great disservice to bags full of scum.
Mr Black
18
Years of Service
User Offline
Joined: 20th Oct 2005
Location: USA
Posted: 20th May 2006 13:55
Thank you, I thought it would be something stupid, i thought it automatically overwrote it, thanx.

It was just
like you said.

And I had it in a gosub and i had error if file=0 error commands before, i did mess up the t, i changed 1 part but not all sorry. In my code its all the same. So im not THAT much of a noob.

Login to post a reply

Server time is: 2024-09-24 23:28:04
Your offset time is: 2024-09-24 23:28:04