Login
Back to forumSee the full topicGo to last reply

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)



Back to top


Copyright © Plus/4 World Team, 2001-2024