ReadFile()

Just starting out? Need help? Post your questions and find answers here.
AlbertoZ
New User
New User
Posts: 1
Joined: Tue Jun 25, 2024 2:22 pm

ReadFile()

Post 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)
User avatar
Kiffi
Addict
Addict
Posts: 1509
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: ReadFile()

Post by Kiffi »

In order for us to see your images, you must upload them to an image hoster (for example https://imgur.com/).
Hygge
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: ReadFile()

Post by Fred »

You need to use .i instead of .l for all #PB_Any return.
boddhi
Enthusiast
Enthusiast
Posts: 524
Joined: Mon Nov 15, 2010 9:53 pm

Re: ReadFile()

Post 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....
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