PB 4.2 bug when read PREF file

Working on new editor enhancements?
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

PB 4.2 bug when read PREF file

Post by Rook Zimbabwe »

I got a pref file:
  • [Global]
    SEL0 = APPETIZER
    SEL1 = HAMBURGER
    SEL2 = FAJITA
    SEL3 = DRINKS
    SEL4 = SPECIALS
    SEL5 = TACO
    SEL6 = GRILL
    SEL7 = INACTIVE
    SEL8 = INACTIVE
    SEL9 = INACTIVE
    SEL10 = INACTIVE
    SEL11 = INACTIVE
    SEL12 = INACTIVE
    [Server]
    SEL0 = 192.168.1.2
    [Taxrate]
    SEL0 = 0.0825
    [Moneysign]
    SEL0 = $
Wen PB 4.2 reads it with the following code"

Code: Select all

;- *** OPEN PREFS
OpenPreferences("menu.pref"); Preferences.prefs
  PreferenceGroup("Global")
    For i = 0 To 12
          se$ = Str(i)       
          ;Delay(444) ; ******  threw in a dealy but get the same BAD results!
        ITEMS$(0+i) = ReadPreferenceString("SEL"+se$, "")
        Debug "SEL"+se$+" = "+ITEMS$(0+i)
    Next
    PreferenceGroup("Taxrate")
      Taxrate.d  = ReadPreferenceDouble("SEL0", 0.0525)
      Debug Taxrate
    PreferenceGroup("Server")
      Server$  = ReadPreferenceString("SEL0", "")
      Debug "SERVER: "+Server$
    PreferenceGroup("Moneysign")
      moneysign$ = ReadPreferenceString("SEL0", "")
      Debug "MONEY: "+moneysign$
ClosePreferences()
I get this output:
SEL0 =
SEL1 = HAMBURGER
SEL2 = ZERFAJITA
SEL3 = DRINKS
SEL4 = ECIALS
SEL5 = TISPTACO
SEL6 = RILL
SEL7 = CTIVE
SEL8 = INACTIVE
SEL9 = INACTIVE
SEL10 = INACTIVE
SEL11 = INACTIVE
SEL12 = INACTIVE
0.082500000000000004
SERVER: .168.1.2
MONEY: PPEGINA192$
Notice that SEL0 does not even show up.

I am working with the issue, but cannot figure out what is going on... looks like truncation, but???

I tried renumbering the pref file and starting with 1 instead of 0. OK silly idea but heck...
Last edited by Rook Zimbabwe on Mon Dec 31, 2007 1:24 am, edited 1 time in total.
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

Hi Rook

Works here (and as there is no #13, produces a blank line). I get:

Code: Select all

APPETIZER
HAMBURGER
FAJITA
DRINKS
SPECIALS
TACO
GRILL
INACTIVE
INACTIVE
INACTIVE
INACTIVE
INACTIVE
INACTIVE

0.082500000000000004
SERVER: 192.168.1.2
MONEY: $
Is this in the PureBasic editor section because you created the preferences file with the IDE?

Actually I just did that and still get the same result.
Dare2 cut down to size
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

With the edited code I get:

Code: Select all

SEL0 = APPETIZER
SEL1 = HAMBURGER
SEL2 = FAJITA
SEL3 = DRINKS
SEL4 = SPECIALS
SEL5 = TACO
SEL6 = GRILL
SEL7 = INACTIVE
SEL8 = INACTIVE
SEL9 = INACTIVE
SEL10 = INACTIVE
SEL11 = INACTIVE
SEL12 = INACTIVE
0.082500000000000004
SERVER: 192.168.1.2
MONEY: $
Dare2 cut down to size
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

I have a lot going on... let me move this up to the front of the program and see what happens... porgram is only at 3100 lines of code!

Are you using 4.2beta?
Last edited by Rook Zimbabwe on Mon Dec 31, 2007 1:29 am, edited 1 time in total.
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

Two questions:

1: How is your pref file created?

2: Why is this a PureBasic Editor issue? Wrong forum? Too many of those pyss-weak beers? :D
Dare2 cut down to size
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

In 4.1 this works! In 4.2 I get that crud!
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

Okay.

I am also using 4.2 to read. Do you create the file with 4.2 or is it externally created?

Just hoping to help! :)

And ..
* ducks *
.. still thinking that this is a general discussion or coding questions or bug report post because I am not sure what the IDE has to do with it.
Dare2 cut down to size
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

file created with PREFeditor made in 3.94 but... even when I do this:

Code: Select all

OpenPreferences("menu.pref"); Preferences.prefs
  PreferenceGroup("Global")
   ; For i = 0 To 12
         ; se$ = Str(i)       
           ITEMS$(0) = ReadPreferenceString("SEL0", "")
            ITEMS$(1) = ReadPreferenceString("SEL1", "")
            ITEMS$(2) = ReadPreferenceString("SEL2", "")
            ITEMS$(3) = ReadPreferenceString("SEL3", "")
            ITEMS$(4) = ReadPreferenceString("SEL4", "")
            ITEMS$(5) = ReadPreferenceString("SEL5", "")
            ITEMS$(6) = ReadPreferenceString("SEL6", "")
            ITEMS$(7) = ReadPreferenceString("SEL7", "")
            ITEMS$(8) = ReadPreferenceString("SEL8", "")
            ITEMS$(9) = ReadPreferenceString("SEL9", "")
            ITEMS$(10) = ReadPreferenceString("SEL10", "")
            ITEMS$(11) = ReadPreferenceString("SEL11", "")
            ITEMS$(12) = ReadPreferenceString("SEL12", "")
   ; Next
    PreferenceGroup("Taxrate")
      Taxrate.d  = ReadPreferenceDouble("SEL0", 0.0525)
      Debug Taxrate
    PreferenceGroup("Server")
      Server$  = ReadPreferenceString("SEL0", "")
      Debug "SERVER: "+Server$
    PreferenceGroup("Moneysign")
      moneysign$ = ReadPreferenceString("SEL0", "")
      Debug "MONEY: "+moneysign$
ClosePreferences()
Same error... truncating in the same fashion. It is weird... I am running an Athlon 3200+ with 1.5 gig mem... Could it be too fast?
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

Switching to BUG REPORTS
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

Before you do ...

What does a hex editor show? Or this:

Code: Select all

sz=FileSize("path to pref")             ; Change to path, 2 lines
OpenFile(0,"path to  pref")
For i=1 To sz
  v = ReadByte(0) & $FF
  Debug Str(i) + " = " + Hex(v) + " : "  + Chr(v)
Next
CloseFile(0)

Edit:

BTW, if you have JaPBe, does it happen with that?
Dare2 cut down to size
Post Reply