MemFile System
#8
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:

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).
Reply


Messages In This Thread
MemFile System - by SMcNeill - 08-22-2022, 03:08 PM
RE: MemFile System - by SpriggsySpriggs - 08-22-2022, 03:16 PM
RE: MemFile System - by SMcNeill - 08-22-2022, 03:20 PM
RE: MemFile System - by SpriggsySpriggs - 08-22-2022, 03:29 PM
RE: MemFile System - by SMcNeill - 08-22-2022, 03:34 PM
RE: MemFile System - by SMcNeill - 08-22-2022, 04:07 PM
RE: MemFile System - by SMcNeill - 08-23-2022, 01:16 PM
RE: MemFile System INPUT output - by JRace - 08-23-2022, 10:56 PM
RE: MemFile System - by PhilOfPerth - 08-27-2022, 05:25 AM
RE: MemFile System - by PhilOfPerth - 08-27-2022, 06:22 AM
RE: MemFile System - by SMcNeill - 08-27-2022, 06:37 AM
RE: MemFile System - by PhilOfPerth - 08-27-2022, 08:02 AM
RE: MemFile System - by SpriggsySpriggs - 08-31-2022, 02:14 PM
RE: MemFile System - by SMcNeill - 08-31-2022, 03:01 PM
RE: MemFile System - by RhoSigma - 08-31-2022, 05:20 PM



Users browsing this thread: 6 Guest(s)