Announcement
Collapse
No announcement yet.
INPUT won't read commas
Collapse
X
-
Thanks, Mel! That works. I thought there might be some connection with handling comma delimited fields but didn't think to use LINE INPUT.
-
Short answer: Change
INPUT "input: "; t$ to
LINE INPUT "input: ";t$
Longer answer: It's not a bug. INPUT was designed to handle comma delimited data files. For example, suppose you have a data base consisting of LastName, FirstName, and TelephoneNumber. You would structure the input something like:
INPUT #1,lName$, fName, tNumber. In this instance, $crlf would be treated as a comma.
Line Input, OTOH, only sees $crlf as the delimiter. It enters everything up to that point into a string.
Leave a comment:
-
INPUT won't read commas
I'm trying to read console input (to search for text). I found that PBCC 5.0 will not read a comma "," and says the length of the INPUT string is 0. If I enclose the comma with quotes on the input line then it reads just fine. The following code demonstrates the problem.
#COMPILE EXE
#DIM ALL
FUNCTION PBMAIN () AS LONG
DIM t$
PRINT "Inputting a comma returns an empty string."
PRINT
INPUT "input: "; t$
PRINT "output: "; t$
PRINT "Length = ";LEN(t$)
WAITKEY$
END FUNCTION
Is that a feature or a bug? I'd like to read those commas directly without having to explicity include the quotes.
Thanks!Tags: None
Leave a comment: