ok heres the deal.
im writing a typing tutor game where people can paste their own text into a file from wherever to use for practice. The game reads the letters one by one from the file, but i need to skip all spaces, punctuation, carriage returns etc.
here is the code i have made so far:
Function readletter()
If Eof("YOUR WORDS HERE.txt") Then SeekFile("YOUR WORDS HERE.txt",1)
;basically, if eof, then loop the file
Repeat
e = ReadByte("YOUR WORDS HERE.txt")
Until e > 64 And e <91
; cycle through the file until the number returned from readbyte() is within ascii code for A-Z
Return e
End Function
now, when i run this it bombs out rather spectacularly. im guessing that the number returned by readbyte(0 isnt the ascii value. can someone please advise me as to what the integer returned by this function represents, and how i could convert it to the relevant ascii code?
thank you
Neil
im writing a typing tutor game where people can paste their own text into a file from wherever to use for practice. The game reads the letters one by one from the file, but i need to skip all spaces, punctuation, carriage returns etc.
here is the code i have made so far:
Function readletter()
If Eof("YOUR WORDS HERE.txt") Then SeekFile("YOUR WORDS HERE.txt",1)
;basically, if eof, then loop the file
Repeat
e = ReadByte("YOUR WORDS HERE.txt")
Until e > 64 And e <91
; cycle through the file until the number returned from readbyte() is within ascii code for A-Z
Return e
End Function
now, when i run this it bombs out rather spectacularly. im guessing that the number returned by readbyte(0 isnt the ascii value. can someone please advise me as to what the integer returned by this function represents, and how i could convert it to the relevant ascii code?
thank you
Neil