[Gambas-user] Endianness issue with Streams ?

Benoît Minisini benoit.minisini at gambas-basic.org
Wed Feb 7 14:06:28 CET 2024


Le 07/02/2024 à 13:59, Laurent Carlier a écrit :
> While reading data from a file using Read function and changing endianness i
> found a somehow strange behavior.
> 
> ----8<-----
> 
>    Dim $iValue As Integer
>    Dim oFitFile As File
> 
>    oFitFile = Open "toto" For Read
>    $iValue = Read #oFitFile As Short
>    Print Hex$($iValue), $iValue
> ---->8-----
> 
> Setting ByteOrder as Little endian gives:
> 5E9     1513
> Setting ByteOrder as Big endian gives:
> FFFFFFFFFFFFE905        -5883
> 
> 
> So is it expected or is it a bug ?
> 

What's strange?

-- 
Benoît Minisini.



More information about the User mailing list