Le 03/02/2012 15:13, Wally a écrit :
>
> What is wrong in this code ?
>
> Public Sub Button1_Click()
>
> Dim f, r As Single
> Dim pPtr As Pointer
> Dim strm As Stream
>
>    f = 1 / 3
>
>    pPtr = Alloc(1, 4)                 'alloc 4 * 1 Byte for single
>
>    strm = Memory pPtr For Read Write
>
>    Write #strm, f As Single
>
>    r = Read #strm As Single
>
>    Print f     ' -->  0.3333333
>    Print r     ' -->  1.261169E-44
>
>    Close #strm
>    Free(pPtr)
>
> End
>

The stream pointer goes forward after a Write or a Read. You must use Seek!

-- 
Benoît Minisini

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to