Author |
Topic: Line length limit for text output from console app (Read 250 times) |
|
CirothUngol
New Member
member is offline
Odie, Odie, cha cha cha.
Gender:
Posts: 44
|
|
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.
|
|
Logged
|
LB Booster + LB Workshop + LB Builder = My Programs on Google Drive
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
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.
|
|
Logged
|
|
|
|
CirothUngol
New Member
member is offline
Odie, Odie, cha cha cha.
Gender:
Posts: 44
|
|
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. ^_^
|
|
Logged
|
LB Booster + LB Workshop + LB Builder = My Programs on Google Drive
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
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.
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
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.
|
|
|
|
|