Page 1 of 1
PrintN limit
Posted: Thu Nov 13, 2003 10:32 am
by freedimension
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.
Posted: Thu Nov 13, 2003 1:36 pm
by Kale
Hmmm.. here, i too seem to have a 250 char limit on PrintN().
Posted: Thu Nov 13, 2003 4:03 pm
by blueznl
that's somewhere in the docs iirc
Posted: Tue Nov 18, 2003 9:52 pm
by oldefoxx
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