[Coco] About PRINT #1,A,B,C and INPUT #1,A,B,C

Robert Emery remery66 at gmail.com
Sat Feb 11 08:37:09 EST 2023


If spaces acted as delimiters, your READ would only get the first variable
right, while the rest would be empty or a single space.
-Bob

On Fri, Feb 10, 2023, 9:23 PM Allen Huffman via Coco <coco at maltedmedia.com>
wrote:

> I recently wrote a blog post about the Disk BASIC “WRITE” command and what
> it did that PRINT does not.
>
> Now I have a question for the audience…
>
> When you PRINT something using commas to separate the items, it TABs to
> the next 16th position.
>
> PRINT A,B,C
>
> …will print A at the first column, B in the middle o the screen, then C at
> the first column of the next line.
>
> If you write that to a file, like
>
> PRINT #1,A,B,C
>
> …and open the file and use “LINE INPUT #1,A$:PRINT A$”, you will see the
> spaces are written out to the file and you get back a string like:
>
> “A …spaces… B …spaces … C”
>
> Yet "INPUT #1,A,B,C” correctly inputs them as three variables. This tells
> me INPUT must be using those spaces as separators.
>
> BUT, from the keyboard if you do “INPUT A,B,C” and try to type in “1
> …spaces… 2 …spaces… 3”, the INPUT routine appears to ignore the spaces and
> run things together as one number “123” (then prompts ?? For the next two
> times wanting the other two input variables).
>
> You can see this as follows:
>
> 10 INPUT A
> 20 PRINT A
>
> If you run that and type “1   2   3”, you get back the number “123”.
>
> Since INPUT works on tape and disk the same way, I figure there must be
> some extra code for handling this special case, and input from the console
> does not work the same.
>
> Anyone know offhand?
>
> Cheers...
>
> --
> Allen Huffman - PO Box 7634 - Urbandale IA 50323 - 515-999-0227 (vmail/TXT
> only)
> http://www.subethasoftware.com - https://www.facebook.com/subethasoftware
>
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>


More information about the Coco mailing list