LB Booster
« Line length limit for text output from console app »

Welcome Guest. Please Login or Register.
Sep 20th, 2017, 6:18pm


Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
LB Umbrella forum
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Line length limit for text output from console app  (Read 84 times)
CirothUngol
New Member
Image


member is offline

Avatar

Odie, Odie, cha cha cha.


PM

Gender: Male
Posts: 43
xx Line length limit for text output from console app
« Thread started on: Jul 15th, 2017, 5:50pm »

My console TREE.EXE replacement seems to be working great. Quite a bit slower than the original, but with several more options and easily capable of handling full trees on drives with hundreds of thousands of files and folders. While testing, I noticed that there seems to be a limit of around 100 characters to the length of a line PRINTed in the console when the output is redirected (saved) to a text file. Please look at the following test Code:
' test for redirected console output

FOR i = 1 TO 255
    v$ = v$; "-"
    PRINT v$
NEXT i

v$ = SPACE$(70)
FOR i = 71 TO 255
    v$ = v$; "-"
    PRINT v$
NEXT i

v$ = ""
FOR i = 2 TO 255 STEP 2
    v$ = v$; "- "
    PRINT v$
NEXT i

v$ = ""
FOR i = 5 TO 255 STEP 5
    v$ = v$; "---- "
    PRINT v$
NEXT i

END 
Compile as a console app and redirect the output to a text file (TEST.EXE>test.txt). It seems as if spaces get converted to carriage returns at around character #102, like it's creating pages from the output (Incidently, the MAINWIN seems to do this at around character #240).
Is there a way to avoid this? TREE requires the ability to output lines of inordinate length (255+). Hopefully I've done something wrong and there is a simple solution.
User IP Logged

LB Booster + LB Workshop + LB Builder = My Programs on Google Drive
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1269
xx Re: Line length limit for text output from console
« Reply #1 on: Jul 15th, 2017, 8:05pm »

on Jul 15th, 2017, 5:50pm, CirothUngol wrote:
TREE requires the ability to output lines of inordinate length (255+).

I've always thought of the Windows console as being an old-fashioned teletype-like interface with a line length of no more than 80 characters or so. Even when redirecting the output to a file, I would have expected that file to be compatible with a standard 'line printer' page width.

Anyway I've made a note to allow longer lines in a future version of LBB, should there be one.

Richard.
User IP Logged

CirothUngol
New Member
Image


member is offline

Avatar

Odie, Odie, cha cha cha.


PM

Gender: Male
Posts: 43
xx Re: Line length limit for text output from console
« Reply #2 on: Jul 17th, 2017, 9:50pm »

Thanks for the consideration, hopefully it may be included in some future update... I'm just glad to know that I wasn't doing anything wrong. ^_^
User IP Logged

LB Booster + LB Workshop + LB Builder = My Programs on Google Drive
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1269
xx Re: Line length limit for text output from console
« Reply #3 on: Jul 19th, 2017, 09:49am »

on Jul 15th, 2017, 5:50pm, CirothUngol wrote:
Is there a way to avoid this?

Actually I think there is a workaround of sorts. If you output the string in chunks of no more than (say) 80 characters I would not expect the wraparound effect to occur. Try this for example:

Code:
FOR i = 1 TO 255
    v$ = v$; "-"
    PRINT LEFT$(v$,80);
    PRINT MID$(v$,81,80);
    PRINT MID$(v$,161,80);
    PRINT MID$(v$,241,80)
NEXT i 

This will affect the output only when compiled as a console application.

Richard.
« Last Edit: Jul 19th, 2017, 4:44pm by Richard Russell » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1269
xx Re: Line length limit for text output from console
« Reply #4 on: Jul 21st, 2017, 06:40am »

on Jul 19th, 2017, 09:49am, Richard Russell wrote:
Actually I think there is a workaround of sorts.

Here's a more elegant solution which works for an arbitrary length of string:

Code:
FOR i = 1 TO 255
    v$ = v$; "-"
    CALL print v$
NEXT i
END

SUB print a$
    WHILE LEN(a$) > 80
        PRINT LEFT$(a$,80);
        a$ = MID$(a$,81)
    WEND
    PRINT a$
END SUB 

Obviously this isn't as satisfactory as modifying LBB so it doesn't wrap console output, which I will attempt in the next release, but it's a temporary fix.

Richard.
« Last Edit: Jul 21st, 2017, 06:49am by Richard Russell » User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Donate $6.99 for 50,000 Ad-Free Pageviews!


This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls