[SOLVED] ReadString() and reading length

Just starting out? Need help? Post your questions and find answers here.
boddhi
Enthusiast
Enthusiast
Posts: 524
Joined: Mon Nov 15, 2010 9:53 pm

[SOLVED] ReadString() and reading length

Post 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.
Last edited by boddhi on Tue Jun 10, 2025 9:13 pm, edited 1 time in total.
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
SMaag
Enthusiast
Enthusiast
Posts: 301
Joined: Sat Jan 14, 2023 6:55 pm
Location: Bavaria/Germany

Re: ReadString() and reading length

Post 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
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4945
Joined: Sun Apr 12, 2009 6:27 am

Re: ReadString() and reading length

Post by RASHAD »

Egypt my love
boddhi
Enthusiast
Enthusiast
Posts: 524
Joined: Mon Nov 15, 2010 9:53 pm

Re: ReadString() and reading length

Post 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:
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
Post Reply