Page 1 of 1

ReadFile()

Posted: Tue Jun 25, 2024 2:37 pm
by AlbertoZ
Same program compiled with different versions of PureBasic !!!

[img]D:\Driver\CatturaSchermate\Sniptool v1.8\CS\PureBasic_6.04_NO_ERROR.png[/img]
[img]D:\Driver\CatturaSchermate\Sniptool v1.8\CS\PureBasic_6.10_11_ERROR.jpg[/img]

:?

// Instructions Unclear. Moved from "Bugs - Windows" to "Coding Questions" (Kiffi)

Re: ReadFile()

Posted: Tue Jun 25, 2024 3:16 pm
by Kiffi
In order for us to see your images, you must upload them to an image hoster (for example https://imgur.com/).

Re: ReadFile()

Posted: Tue Jun 25, 2024 3:27 pm
by Fred
You need to use .i instead of .l for all #PB_Any return.

Re: ReadFile()

Posted: Tue Jun 25, 2024 4:29 pm
by boddhi
In addition to what Fred wrote and for a better understanding:

On 32-bit systems (i.e. 4 bytes x 8 bits), Integers (.i) are equivalent to Longs (.l) because they require 4 bytes.
But on 64-bit systems (i.e. 8 bytes x 8 bits), Integers use 8 bytes, while Longs continue to require only 4 bytes.

See here: https://www.purebasic.com/documentation ... ables.html

So the same code may work on a 32-bit machine but crash on a 64-bit machine because many of the values used are of the 8-byte type.

This is why, with a few exceptions (e.g. for colors), for the sake of compatibility, it's preferable to use Integers rather than Longs. Particularly when using old code from PB forums.

:wink:

PS :
AlbertoZ wrote: [img]D:\Driver\CatturaSchermate\Sniptool v1.8\CS\PureBasic_6.04_NO_ERROR.png[/img]
[img]D:\Driver\CatturaSchermate\Sniptool v1.8\CS\PureBasic_6.10_11_ERROR.jpg[/img]
As said Kiffi, it is necessary to use links to a hosting provider (or a personal dedicated server) for images (preferably with an https link, as many users, for security reasons, set their browsers to accept only this type of link), as those stored on local disk cannot be displayed. Because if this were the case, let's imagine that the local PC was switched off, it would be impossible to access images....