Login
Forum Help



Post Your Message
Username: (Login)

Topic:
Message:
 


Previous Messages
Posted By

JamesC
on 2003-12-25
 Re: Another BASIC bug

I would have to agree with Csabo about using the LEFT$, MID$, and RIGHT$ functions. This makes a program listing easier to read, as well as easier to convert to a lower BASIC (such as C64's 2.0).

Using the string functions instead of PRINT USING may take a few more cycles, but if you're programming in BASIC anyway, the cycles are probably not an issue. happy

Posted By

SVS
on 2003-12-22
 Re: Another BASIC bug

Thank you Csabo for the tips.
What I meant was the ability to obtain 00:01:23 or 00:00:01 or 00:12:34 with a plain PRINT USING command. This is not possible (IMO) because the filling char (0 in the case) is used also to fill the shodow commas (happy

P.S. - In coming soon BAL LANGUAGE (I'm releasing) it runs as well happy)

Posted By

Csabo
on 2003-12-22
 Re: (not) Another BASIC bug

Good point. I think this is intended behavior though, not a bug. I assume this is what you tried:

PUDEF "0:" : PRINT USING "##,##,##"; VAL(TI$)

It does indeed produce results like "00099:99" for values up to 9999. (Above that, it works as you have expected; "01:00:00".)

Remember though, that the first character in PUDEF redefines the BLANKS, and the second redefines the COMMAS. When printing a regular right-aligned number, which is what I think PRINT USING was intended for, you normally would not want an output like this: "___,__1,000", that is, you don't want commas to appear before the first digit. That's why PRINT USING uses a blank there - or in your case the character you specified for blank, which is "0".

If you really want to use PRINT USING to print "00:01:23", it is in fact possible. The trick is to redefine the decimal point as well, like this:

PUDEF "0::" : PRINT USING "##.##,##"; VAL(TI$)/10000

The above proves that PRINT USING is suitable for this task. Or you can still use a simple work around like:

? LEFT$(TI$,2)":"MID$(TI$,2)":"RIGHT$(TI$,2)

Posted By

SVS
on 2003-12-22
 Another BASIC bug

I've discovered a new bug on Basic command PRINT USING.
In fact it is impossible to obtain a mask able to print:
00:01:23 (a pattern very usable in times printing).
If you set PUDEF "0" to fill the unusable characters, you'll obtain:
00001:23


Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon