Opsss... I forgot that "Write" made the stream internal pointer go forward.
Ok
regards
vuott
Ven 27/12/13, Ru Vuott ha scritto:
Oggetto: Re: [Gambas-user] R: ieee754
A: "mailing list for gambas users"
Data: Venerdì 27
ello Jussi,
> Seek #hStr, 0
>
> f = Read #hStr As Single
I didn't set "Seek" in my suggestion, because I thought the reading started
from zero "by default".
bye
vuott
Ven 27/12/13, Jussi Lahtinen ha scrit
Le 27/12/2013 15:20, wally a écrit :
> Thank You Jussi
>
> it's the 27th time i forgot the seek command :)
> now works
>
You can do that now since Gambas 3.1:
Dim i As Integer
Dim x As Single
i = &H3EAA&
x = Single@(VarPtr(i))
OR
i = &H3EAA&
x = Single@(MkInt$(i))
Isn't it faster?
-
Thank You Jussi
it's the 27th time i forgot the seek command :)
now works
On Friday 27 December 2013 11:31:10 Ru Vuott wrote:
> Using Memory Stream:
>
> Public Sub Main()
>
> ' i = &h3EAA& 'IEEE representation of 1/3
>
> Dim i As Integer
> Dim x As Single
> Dim p As Pointer
> Dim s As S
Not sure what you are doing exactly, but this may enhance compatibility.
hStr.ByteOrder = gb.LittleEndian
Jussi
On Fri, Dec 27, 2013 at 3:56 PM, Jussi Lahtinen wrote:
> Dim i As Integer
> Dim f As Single
> Dim p As Pointer
> Dim hStr As Stream
>
> i = &h3EAA&
>
> p = Alloc(S
Dim i As Integer
Dim f As Single
Dim p As Pointer
Dim hStr As Stream
i = &h3EAA&
p = Alloc(SizeOf(gb.Integer))
hStr = Memory p For Read Write
Write #hStr, i As Integer
Seek #hStr, 0
f = Read #hStr As Single
Print f
Free(p)
Close #hStr
Seek i
Thank You !
but result is "1.261169E-44"
expected "3.3E-1"
3.3313465118408203125E-1
On Friday 27 December 2013 11:31:10 Ru Vuott wrote:
> Using Memory Stream:
>
> Public Sub Main()
>
> ' i = &h3EAA& 'IEEE representation of 1/3
>
> Dim i As Integer
> Dim x As Single
> Dim p As Poi
Thank You !
On Friday 27 December 2013 11:31:10 Ru Vuott wrote:
> Using Memory Stream:
>
> Public Sub Main()
>
> ' i = &h3EAA& 'IEEE representation of 1/3
>
> Dim i As Integer
> Dim x As Single
> Dim p As Pointer
> Dim s As Stream
>
> i = &h3EAA&
>
>
> p = Alloc(4)
>
>
Using Memory Stream:
Public Sub Main()
' i = &h3EAA& 'IEEE representation of 1/3
Dim i As Integer
Dim x As Single
Dim p As Pointer
Dim s As Stream
i = &h3EAA&
p = Alloc(4)
s = Memory p For Write
Write #s, i As Integer
Read #s, x
Print x
Free(p