INPUT That Puts Anything In
Here's an interesting Commodore input routine that I'd like to share with you. Ever notice that when you INPUT a string which has a comma or colon that the computer only takes in the part before the punctuation and then prints EXTRA IGNORED?
Here's how to get around it. Say you want to INPUT C$:
10 GOSUB 1000: C$=B$ 20 PRINT B?: END 1000 B$ = "" 1010 GET A$: IF A$ = "" THEN 1010 1020 PRINT A$; 1030 IF A$ = CHR$(13) THEN RETURN: REM 13 MEANS THE RETURN KEY WAS TYPED 1040 B$ = B$ + A$ 1050 GOTO 1010
When you run this, you don't get the normal question mark. Now you can put in anything you want, but don't use A$ or B$ any place except in this subroutine. Whenever you want to put in a string, GOSUB to 1000 and, when you come back with RETURN, just let the string you're looking for (C$ in this example) be equal to B$.
George Trepal
This INPUT routine is great for people who will want to use a computer program, but don't know about avoiding commas, etc. Whatever they type, the program will take it in without stopping and going to an error message and then saying READY. It's also possible to use delete and insert to correct errors (but these "characters" will be included in the final string).
To prove it, run this and type TEST the first time. Then, when the program ends, type: ?LEN(B$) to see how long B$ is. You will get four as the answer. Now run it again and type TESX and then use the delete key to change the X back to a T. ?LEN(B$) will now give you a six because B$ still contains the X and a character for a delete. You don't notice these extra characters, though, because when B$ is PRINTed, it puts the X on the screen and then deletes X, replacing it with T. It's too quick to see.