Issue with BOM

Just starting out? Need help? Post your questions and find answers here.
kinglestat
Enthusiast
Enthusiast
Posts: 746
Joined: Fri Jul 14, 2006 8:53 pm
Location: Malta
Contact:

Issue with BOM

Post by kinglestat »

I had this code which worked on the 5.71 PB and now it doesn't with 6.1
has the BOM logic changed ?

Code: Select all

f = ReadFile( #PB_Any, filename, #PB_File_NoBuffering )

         If Not f
            filename = ""
            MessageRequester("LJLAng", "Could not read file")
         Else
            SetWindowTitle( #MainWindow, "Compiler - " + filename )
            
            format   = ReadStringFormat( f )             ;  Thanks to Infratec and Mesa
            LJLang::ValidTextFormat(format)
            
            body = ReadString(f,format | #PB_File_IgnoreEOL,#PB_File_IgnoreEOL)
I may not help with your coding
Just ask about mental issues!

http://www.lulu.com/spotlight/kingwolf
http://www.sen3.net
Cyllceaux
Enthusiast
Enthusiast
Posts: 514
Joined: Mon Jun 23, 2014 1:18 pm

Re: Issue with BOM

Post by Cyllceaux »

This line is wrong

Code: Select all

body = ReadString(f,format | #PB_File_IgnoreEOL,#PB_File_IgnoreEOL)
The last Parameter is a number

Code: Select all

body = ReadString(f,format | #PB_File_IgnoreEOL | #PB_File_IgnoreEOL, Lof(f))
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Issue with BOM

Post by infratec »

In general you don't need this optional length parameter.
Only if you want to read an exact number of bytes.
User avatar
HeX0R
Addict
Addict
Posts: 1219
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Issue with BOM

Post by HeX0R »

Cyllceaux wrote: Thu May 23, 2024 12:25 pm

Code: Select all

body = ReadString(f,format | #PB_File_IgnoreEOL | #PB_File_IgnoreEOL, Lof(f))
I prefer

Code: Select all

body = ReadString(f,format | #PB_File_IgnoreEOL | #PB_File_IgnoreEOL | #PB_File_IgnoreEOL, Lof(f))
:lol:
boddhi
Enthusiast
Enthusiast
Posts: 524
Joined: Mon Nov 15, 2010 9:53 pm

Re: Issue with BOM

Post by boddhi »

HeX0R wrote:

Code: Select all

body = ReadString(f,format | #PB_File_IgnoreEOL | #PB_File_IgnoreEOL | #PB_File_IgnoreEOL, Lof(f))
:lol:
I hadn't dared!
But hey, let's be crazy, why not:

Code: Select all

body = ReadString(f,format | #PB_File_IgnoreEOL | #PB_File_IgnoreEOL | #PB_File_IgnoreEOL | #PB_File_IgnoreEOL, Lof(f))
:mrgreen: :D :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...
AZJIO
Addict
Addict
Posts: 2225
Joined: Sun May 14, 2017 1:48 am

Re: Issue with BOM

Post by AZJIO »

Code: Select all

Debug #PB_File_IgnoreEOL ; 65536
using the third parameter, the author of the topic limits the number of bytes read (65536). This may be the reason that a larger file will be truncated. The third parameter is not intended to use the constant #PB_File_IgnoreEOL , it looks absurd, an error.
Cyllceaux
Enthusiast
Enthusiast
Posts: 514
Joined: Mon Jun 23, 2014 1:18 pm

Re: Issue with BOM

Post by Cyllceaux »

boddhi wrote: Thu May 23, 2024 10:29 pm
HeX0R wrote:

Code: Select all

body = ReadString(f,format | #PB_File_IgnoreEOL | #PB_File_IgnoreEOL | #PB_File_IgnoreEOL, Lof(f))
:lol:
I hadn't dared!
But hey, let's be crazy, why not:

Code: Select all

body = ReadString(f,format | #PB_File_IgnoreEOL | #PB_File_IgnoreEOL | #PB_File_IgnoreEOL | #PB_File_IgnoreEOL, Lof(f))
:mrgreen: :D :wink:
To be honest... I only saw the last Parameter and the constant... I didn't check it :oops:
kinglestat
Enthusiast
Enthusiast
Posts: 746
Joined: Fri Jul 14, 2006 8:53 pm
Location: Malta
Contact:

Re: Issue with BOM

Post by kinglestat »

Thanks guys I will try it out
I may not help with your coding
Just ask about mental issues!

http://www.lulu.com/spotlight/kingwolf
http://www.sen3.net
boddhi
Enthusiast
Enthusiast
Posts: 524
Joined: Mon Nov 15, 2010 9:53 pm

Re: Issue with BOM

Post by boddhi »

Cyllceaux wrote: To be honest... I only saw the last Parameter and the constant... I didn't check it :oops:
It happens to everyone. Sometimes between precipitation and forgetting to modify elements in the message... We have the choice! :mrgreen:

It was just an opportunity to laugh a little... without thinking badly about it. :) :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