19 August 2021, 08:20 | #1 |
Registered User
Join Date: Dec 2012
Location: Vancouver/Canada
Posts: 676
|
Issue with spacing...
Hello guys,
I have issue when it comes to spacing when saving files to disk in AMOS. I have an array called: LEVELGETCARD$(WIDTH, HEIGHT)="2" When I use Open Out and Print #1 to save or even use text 32,32,_STR$ or Print _STR$ I get: 2 2 2 2 2 2 2 2 2 2 2 2 2 --- instead of ---> 2222222222222 I tried: For HEIGHT=0 to 49 For WIDTH=0 to 49 _GETSTR$=_GETSTR$+LEVELGETCARD$(WIDTH, HEIGHT) ... ... Next WIDTH Next HEIGHT It comes out as 2 2 2 2 2 instead of 22222....then I tried: For HEIGHT=0 to 49 For WIDTH=0 to 49 _GETSTR$=_GETSTR$+Space$(0)+LEVELGETCARD$(WIDTH, HEIGHT) ... ... Next WIDTH Next HEIGHT It comes out as 2 2 2 2 instead of 22222....then I tried For HEIGHT=0 to 49 For WIDTH=0 to 49 LEVELGETCARD$(WIDTH,HEIGHT)="2"+Space$(0) _GETSTR$=_GETSTR$+LEVELGETCARD$(WIDTH, HEIGHT) ... ... Next WIDTH Next HEIGHT It comes out as 2 2 2 2 instead of 2222....even if I print it on screen such as Print or Text 32,32 ....or Print #1, .... What advice someone can help me? |
19 August 2021, 15:04 | #2 |
Total Chaos forever!
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,187
|
The sign is a space for positive numbers. If it were negative the minus sign would be there.
|
19 August 2021, 17:48 | #3 |
Registered User
Join Date: Feb 2017
Location: Oslo
Posts: 90
|
It seems to work as expected if you literally initialise the array like this
Code:
For HEIGHT=0 to 49 For WIDTH=0 to 49 LEVELGETCARD$(WIDTH, HEIGHT)="2" Next WIDTH Next HEIGHT Because it doesn't quite make sense to encode numbers as strings and then save these strings without any separating character, like space [unless all numbers are in the range 0-9]. |
19 August 2021, 22:04 | #4 | |
Registered User
Join Date: Dec 2012
Location: Vancouver/Canada
Posts: 676
|
Quote:
How should I have initialized the array then? |
|
19 August 2021, 22:41 | #5 |
Registered User
Join Date: Feb 2017
Location: Oslo
Posts: 90
|
If you converted numbers to strings with Str$(NUMBER), you could replace it with Str$(NUMBER)-" " to get rid of the whitespace.
Alternatively, if NUMBER always lies between 0-255 you could consider using Chr$(NUMBER) instead, and let the reverse operation from string to number be done with Asc. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
B.A.T. II issue | demoniac | support.WinUAE | 8 | 18 November 2020 04:51 |
CF issue | Blipsqueak | support.Hardware | 3 | 27 April 2018 05:32 |
CF issue? | zerohour1974 | support.Hardware | 19 | 28 September 2016 20:31 |
amiga computing vol 2 issue 1 (issue 13 anyone) | Mort | request.Other | 0 | 30 November 2010 11:27 |
Re-issue | Galahad/FLT | HOL suggestions and feedback | 4 | 26 April 2003 16:48 |
|
|