Page 1 of 1

Reading a line from a file and comparing.

Posted: Sat Jun 17, 2017 3:44 pm
by MarkSkits
I'm working on an operating environment in QuickBasic 4.5.

I need help loading saving and loading from a line of code in a file like example.sys for a password system.

Here's what I have the code as so far:

Code: Select all

INPUT "Enter Password you want to set: ",setpass$
INPUT "Confirm: ",confirmpass$
IF confirmpass$ = setpass$ THEN password$ = setpass$ ELSE PRINT "Passwords not identical!":SLEEP 2:GOTO SETPASS
(Code that saves line of code to file)
After reboot:

Code: Select all

(Code that sets the value of password$ from a specific line of code.)
INPUT "Enter Password: ",passinput$
IF passinput$ = password$ THEN GOTO DESKTOP ELSE PRINT "Wrong Password!":SLEEP 3:GOTO PASSWORD
Basically, how would I store a value onto a file and be able to access it later?

Re: Reading a line from a file and comparing.

Posted: Sun Jun 18, 2017 9:22 pm
by burger2227
You have to OPEN a file and WRITE or PRINT the word to the file.

To read the file you need to OPEN the filename and INPUT the word(s) from the file.

PS: QB64 does not need DOS and it works better and faster on PC's from XP up.