How do I limit user input
Posted: Thu Jun 15, 2017 4:16 am
I searched around here before asking, but I've also googled this and am coming up empty handed. Perhaps it's in the way I am searching, I don't know, but anyhow...
So as you are probably aware, when coding in Qbasic (or any basic for that matter) if you don't have a way to stop user input after so many characters, then some clown down the road is going to continue typing nonsense into your input line, just to watch it scroll to the next line and so on, until your page disappears and the program crashes.
So, I am trying to figure out how to stop user input after they type, say 10 characters (for example). I know there's a way to do this. I believe it has something to do with the LEN statement, possibly RIGHT$, but I cannot seem to figure it out. If someone would be so kind as to give me the code, I would be forever grateful and offer sacrifices to whatever god you worship with one of my fatted calves. Thanks!
So as you are probably aware, when coding in Qbasic (or any basic for that matter) if you don't have a way to stop user input after so many characters, then some clown down the road is going to continue typing nonsense into your input line, just to watch it scroll to the next line and so on, until your page disappears and the program crashes.
So, I am trying to figure out how to stop user input after they type, say 10 characters (for example). I know there's a way to do this. I believe it has something to do with the LEN statement, possibly RIGHT$, but I cannot seem to figure it out. If someone would be so kind as to give me the code, I would be forever grateful and offer sacrifices to whatever god you worship with one of my fatted calves. Thanks!