When you are getting
INPUT in Commodore BASIC it always adds a question mark at the end of the string you want to show.
Is there a way to suppress the question mark when using the
INPUT# command is meant for non-interactive I/O on files or devices, i.e. reading from a file on disk, serial port, whatever. Because it is non-interactive, it will not display a prompt anywhere. The keyboard can be opened like any other I/O device, it has device number 0. Knowing that, the implementation is straightforward.
10 OPEN 1,0:REM OPEN DEVICE 0 AS FILE #1 20 PRINT"TYPE SOME TEXT:"; 30 INPUT#1,A$ 40 PRINT"YOU TYPED:";A$
Is there a way to suppress the question mark when using the INPUT command?
No. There are also other problems with using
INPUT to get keyboard input. The Commodore PET had a problem where just typing
Return would stop the program which probably also exists on the C64. You might be better using the
Back in the day I wrote my own input code using GET. Over time I enhanced it to support various features. You start out with GET A$. Here is a simple one I just threw together:
10 NA$="":PR$="Name:" 20 GOSUB 50000 30 PRINT"Your name is "; 40 END 50000 PRINT PR$; 50010 GET A$:IF A$="" THEN 50010 50020 IF A$=CHR$(13) THEN PRINT:RETURN 50030 IF A$=CHR$(20) THEN NA$=LEFT$(NA$,LEN(NA$)-1):? CHR$(157);" ";CHR$(157);GOTO 50010 50040 IF A$>="a" AND A$<="z" THEN 50080 50050 IF A$>="A" AND A$<="Z" THEN 50080 50060 IF A$=" " THEN 50080 50070 GOTO 50010 50080 NA$=NA$+A$:PRINT A$;:GOTO 50010
You'll have to use the question mark in line 50030 to keep the line short enough for the BASIC editor to accept it. BITD I had a blinking cursor implemented.