Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:40 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2: Bug(?) in INPUT of multiple variables from file

Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 02:37pm 05 Sep 2020
Copy link to clipboard 
Print this post

Try this on for size, does INPUT not work the way I think it does?

Colour Maximite 2
MMBasic Version 5.05.05
Copyright 2011-2020 Geoff Graham
Copyright 2016-2020 Peter Mather

> list "bug2.bas"
Option Explicit
Option Default Integer
Dim i
Dim a(9)
For i = 0 To 9
 a(i) = i + 1
Next i

Open "out.dat" For Output As #1
Print #1,a(0),a(1),a(2),a(3),a(4),a(5),a(6),a(7),a(8),a(9)
Close #1

For i = 0 To 9
 a(i) = -1
Next i

Open "out.dat" For Input As #1
Input #1,a(0),a(1),a(2),a(3),a(4),a(5),a(6),a(7),a(8),a(9)
Close #1

For i = 0 To 9
 Print a(i);
Next i
Print

> run "bug2.bas"
1 0 0 0 0 0 0 0 0 0

> list "out.dat"
1   2   3   4   5   6   7   8   9   10


Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 02:47pm 05 Sep 2020
Copy link to clipboard 
Print this post

Check the manual and then replicate in the file
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 02:57pm 05 Sep 2020
Copy link to clipboard 
Print this post

  matherp said  Check the manual and then replicate in the file


Right, values need to be comma separated in the file unlike BBC BASIC.

Thanks,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025