Posts: 46
Threads: 18
Joined: Jan 2005
ok heres my code
Code:
START$="WHAT IS YOUR NAME"
LOCATE 5,3:PRINT START$
LOCATE 6,3:INPUT NAMEIN$
DO
OPEN "NAMES.DAT" FOR INPUT AS#1
INPUT #1,NAMEF$
IF NAMEF$=NAMEIN$ THEN GOTO 20
IF NAMEF$="END" THEN GOTO 25
LOOP
20
CLOSE
LOCATE 20,5:PRINT " YOUR NAME IS IN MY LIBRARY CREATING PROFILE"
GOTO 40
25
COLOR 4
LOCATE 10,5:PRINT "YOUR NAME IS NOT IN MY LIBRARY"
40
SLEEP 3000
when the name that is stored in names.dat = namein$ it goes to 20 like it should but when it reaches namef$="end" it kinda freezes and doesnt goto 25 why can somebody please help
o live is to die, to die is to expel, to expel is to exist is to live without knowing to be
Posts: 7
Threads: 2
Joined: Apr 2005
Are you sure, that there's an "END" in the file?
Or maybe, the line in your program isn't IF NAMEF$ = "END" THEN...
but ...." END"?
If no IF-expression is true, fb won't quit running the Loop.
For controling, what FB does, you could...
...Change the last line to
LOOP UNTIL EOF(1)
END
=> Quits, when the end of file (EOF) is reached
... add something like
PRINT NAMEF$
in the loop. And then Check, what was read.
Maybe, there's a Space at the end of one line.
For highlighting then, add
WRITE NAMEF$
the printed string will be in "double quotes ", so that you can find spaces easyly.
Hope, this helped you!
ometimes, i think it is not logical to say
x = x + 1
This post is fully recycleable
Posts: 293
Threads: 31
Joined: Nov 2004
You should also be aware that string tests are case senstive also you should should remove any errant spaces in the way.
You may want to use
Code:
IF TRIM$(UCASE$(NAMEF$))="END" then..
his sig left intentionally blank
Posts: 46
Threads: 18
Joined: Jan 2005
thanx dusky_joe the eof(1) worked i was thinking of using that but i couldnt remember how to put it into context ie. chr$ or asc or what not but n e way that was the trick thank you
o live is to die, to die is to expel, to expel is to exist is to live without knowing to be
Posts: 320
Threads: 24
Joined: Feb 2005
One thing: NEVER USE GOTO! You will hate yourself if you use GOTO for much of anything beyond a few lines. Uses SUBs and FUNCTIONs instead, they will make your life WAAAAY easier. Not only that, but much more easy to read, too!
.14159265358979323846264338327950288419716939937510582709445
Glarplesnarkleflibbertygibbertygarbethparkentalelelangathaffendoinkadonkeydingdonkaspamahedron.
Posts: 336
Threads: 4
Joined: Nov 2004
man GOTO has gotten kind of a bad rep since most of the time when it's used , it's used in extreamly unstructed code but goto used correctly can speed up your program alot all goto is , is a jump