Error converting string to int

Mac OSX specific forum
Josemar
User
User
Posts: 10
Joined: Tue Mar 29, 2022 7:51 pm

Error converting string to int

Post by Josemar »

Hello.

When I try to convert a string that contains a date and time:

Code: Select all

Define txt$  = "20230313143030"
Define num.q = Val(txt$)
Debug num

I see that it runs fine in Windows 10 64 bits... and in Widows XP 32 bits, it runs too, I'm surprised :D
The problem is compiling in MacOS (chip intel, OS Monterrey, PB 6,01 LTS) , it prints 12663CA0EAF6

Is it a bug, or a limitation of Mac version of PureBasic?

// Moved from "Bugs - Mac OSX" to "OS Specific Mac OSX" (Kiffi)
Regards,
Josemar
User avatar
deeproot
Enthusiast
Enthusiast
Posts: 284
Joined: Thu Dec 17, 2009 12:00 pm
Location: Llangadog, Wales, UK
Contact:

Re: Error converting string to int

Post by deeproot »

The value of num.q is correct - no bug I think. 12663CA0EAF6 is hex and = 20230313143030.

To ensure the output number format from Debug use either Str() or Hex().
User avatar
mk-soft
Always Here
Always Here
Posts: 6246
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Error converting string to int

Post by mk-soft »

You can set which format the debug output should have.
Certainly set in Preferences
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Josemar
User
User
Posts: 10
Joined: Tue Mar 29, 2022 7:51 pm

Re: Error converting string to int

Post by Josemar »

deeproot wrote: Mon Mar 13, 2023 3:51 pm The value of num.q is correct - no bug I think. 12663CA0EAF6 is hex and = 20230313143030.

To ensure the output number format from Debug use either Str() or Hex().

Thanks, but I have doubts... Is correct that Val() returns an hexadecimal instead a integer value?
Executing that in Windows, it returns an integer.
Regards,
Josemar
Josemar
User
User
Posts: 10
Joined: Tue Mar 29, 2022 7:51 pm

Re: Error converting string to int

Post by Josemar »

mk-soft wrote: Mon Mar 13, 2023 4:45 pm You can set which format the debug output should have.
Certainly set in Preferences
Thanks mk-soft . Just this was my problem, I was set preferences for debugger in Hex (I didn't remember this)

Solve, thanks a lot and sorry for my mistake
Regards,
Josemar
Post Reply