I don't know of any single, thorough explainer of INPUT functionality, and I've never intentionally torture-tested INPUT before, so here goes:
I didn't try to re-create your tester input file, but used a text file which contains:
This test program uses the simple INPUT statement (with just a taste of spaghetti for the TRS-80, which doesn't have fancy-pants features like WHILE...WEND or REPEAT...UNTIL):
What I expected based on experience:
Quotes embedded within an input string will be left unmolested.
A leading quote (and a matching trailing quote if there is one) will be stripped.
Tested on QB 4.5, GW Basic 3.23, Turbo Basic, Free Basic, and even TRS-80 Model III Disk Basic:
It's interesting that INPUT splits the first line after "New York, New York", but aside from the extra blank line that gets spit out, the rest is pretty much what I expected.
Output for all tested Basics except QB64:
Meanwhile, QB64 loses the 111"New York, and also the trailing quote on stand-alone six, so the output looks like this:
I thought that maybe the ANSI full BASIC spec (ANSI X.3113-1987) would give some specific requirements, but no, it only gives lots of words to wade through.
Speaking of ANSI requirements, I dunno if you thought of this:
If an input datum is an unquoted-string, leading and trailing spaces are ignored (cf. 4.1). If it is a quoted-string, then all spaces between the quotation-marks are significant (cf. 6.11).
I didn't try to re-create your tester input file, but used a text file which contains:
Quote:"New York, New York"111"New York, New York"
hi
one with no quotes, "two in quotes", "three with leading quote, four with trailing quote"
"stand-alone five with leading quote
stand-alone six with trailing quote"
toodles
This test program uses the simple INPUT statement (with just a taste of spaghetti for the TRS-80, which doesn't have fancy-pants features like WHILE...WEND or REPEAT...UNTIL):
Code: (Select All)
1 CLS
2 OPEN "I",1,"TEST.TXT"
3 IF NOT EOF(1) THEN INPUT #1, A$: PRINT A$: GOTO 3
4 CLOSE
What I expected based on experience:
Quotes embedded within an input string will be left unmolested.
A leading quote (and a matching trailing quote if there is one) will be stripped.
Tested on QB 4.5, GW Basic 3.23, Turbo Basic, Free Basic, and even TRS-80 Model III Disk Basic:
It's interesting that INPUT splits the first line after "New York, New York", but aside from the extra blank line that gets spit out, the rest is pretty much what I expected.
Output for all tested Basics except QB64:
Quote:New York, New York
111"New York
New York"
hi
one with no quotes
two in quotes
three with leading quote, four with trailing quote
stand-alone five with leading quote
stand-alone six with trailing quote"
toodles
Meanwhile, QB64 loses the 111"New York, and also the trailing quote on stand-alone six, so the output looks like this:
Quote:New York, New York
New York"
hi
one with no quotes
two in quotes
three with leading quote, four with trailing quote
stand-alone five with leading quote
stand-alone six with trailing quote
toodles
I thought that maybe the ANSI full BASIC spec (ANSI X.3113-1987) would give some specific requirements, but no, it only gives lots of words to wade through.
Speaking of ANSI requirements, I dunno if you thought of this:
If an input datum is an unquoted-string, leading and trailing spaces are ignored (cf. 4.1). If it is a quoted-string, then all spaces between the quotation-marks are significant (cf. 6.11).