Page 1 of 1

[SOLVED] ReadString() and reading length

Posted: Tue Jun 10, 2025 8:05 pm
by boddhi
Hi,

In the docs, there is no indication about the maximun length that ReadString() can return.
I searched in the PB forums (Keywords : ReadString Length) and didn't find any concluant post.

I use ReadString(FileNb,#PB_File_IgnoreEOL,#PB_File_IgnoreEOL) to retrieve the whole content of text files and for the first time, one file has more than 65536 chars.
As, in theory, string variables have no length limitation, it seems that ReadString() can't return more than these 65536 chars...

Can you confirm ? Is it a bug or a inherent limitation ? If it really is a limitation, perhaps it should be mentioned in the docs (in which case, I'll create a request in the right section).

Thanks.

Re: ReadString() and reading length

Posted: Tue Jun 10, 2025 8:16 pm
by SMaag
The Problem is not PB.

The second Parameter of ReadString is the length!
You set length as #PB_File_IgnoreEOL = 65536

That's your problem

Re: ReadString() and reading length

Posted: Tue Jun 10, 2025 8:18 pm
by RASHAD

Re: ReadString() and reading length

Posted: Tue Jun 10, 2025 9:11 pm
by boddhi
SMaag wrote: You set length as #PB_File_IgnoreEOL = 65536
That's your problem
:oops: How stupid I am !!!
Thanks :wink:
Thanks for the explicative link, Rashad :wink: