I had a hard time finding a bug with my pbAPM Lib, only to find out, that it's not even a bug of mine. I wanted to PrintN very large numbers with about 1000 digits but it always printed only about 250.
Now my question, is this a limitation of PureBasic or of the way Windows handles consoles (i.e. it can only handle lines of up to 250 Characters)? Just wondering.
PrintN limit
-
freedimension
- Enthusiast

- Posts: 613
- Joined: Tue May 06, 2003 2:50 pm
- Location: Germany
- Contact:
that's somewhere in the docs iirc
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
PrintN() limits you to 250 characters to print at one time. However, your can have strings within PV that are much longer. All you need to do is parse a string and print a portion of it with print(), until you reach the end of the string, and print the remainder using PrintN() so that you have a return at the end of the print. I might suggest that as part of your effort to parse the initial string, you consider the option to check for screen width (80 character count), and back along the string for a "natural" character sepearator. such as space, tab, comma, semi-colon, colon, or whatever and see if you can break the line at that point. and resume checking the string from that point on. For instance:
Code: Select all
;assume s$ is a long string
parse1=1
Repeat
parse2=parse1+80
If parse2>Len(s$)
goto bypass3
EndIf
parse3=parse2
Repeat
parse3-1
If parse2<=parse1
GoTo bypass2
EndIf
Select Mid(s$,parse3,1)
Case " "
Case "."
Case ","
Case "/"
Case "\"
Case Chr(9)
Case ":"
Case ";"
Default
GoTo bypass1
EndSelect
parse2=parse3+1
GoTo bypass2
bypass1:
Forever
bypass2:
Print(Mid(s$,parse1,parse2-parse1)
parse1=parse2
Forever
bypass3:
PrintN(Mid(s$,parse1,parse2-parse1)
End
has-been wanna-be (You may not agree with what I say, but it will make you think).

