Page 1 of 1

saving

Posted: Wed Oct 04, 2006 10:59 pm
by dave
how can i make a program that when a preson enter a name it will look for a file ina cretain location and then read several variables from it and then how can i save that file whenchanges are made to the variables?
i also need it to print a custom message if the file was not found not like "file not found"

Posted: Thu Oct 05, 2006 6:05 am
by Z!re
See OPEN

As for the "file not found" try this link

Posted: Thu Oct 05, 2006 7:55 am
by Patz QuickBASIC Creations

Code: Select all

ON ERROR GOTO FileError
CONST FALSE=0
CONST TRUE=NOT FALSE
Input "Type in the name: ",NAM$
OPEN "c:\your\list\of\names.lst" FOR INPUT ACCESS READ AS #1
LineNumber = 1
NameFound = FALSE
WHILE NOT EOF(1)
LINE INPUT #1, TEMP$
IF UCASE$(TEMP$) = UCASE$(NAM$) THEN
PRINT "The name you specified was found on line ";LineNumber
NameFound=TRUE
END IF
LineNumber = LineNumber+1
If NameFound = FALSE Then Print "The name you specified was not found."
END

FileError:
Print "An error occured while opening your file."
END
That quick code will find the names... As for editing them, I will not put code up for that. It seems like this is a homework assignment...


As for the avatar... You could, but it has to be hosted on another site. Pete's site has a file limit size that won't support most animations.

REPLY

Posted: Mon Oct 09, 2006 4:43 pm
by dave
ACTUALLY IT ISNT a home work assignment were still on random slow school
im trying to make a game and when you sign it it looks for the file and if you dont sign in right then it says the custom error message