[Gambas-user] Pointer-Memory Question
nando
nando_f at ...951...
Sat Feb 4 05:55:58 CET 2012
Is this a possible reason?
Write #strm moves the "pointer" to 4 past where it was first set.
Read is reading a SINGLE immediately after what you wrote
You need to seek backwards 4 places
??
-Fernando
---------- Original Message -----------
From: Wally <wally at ...2037...>
To: Gambas-user at lists.sourceforge.net
Sent: Fri, 03 Feb 2012 15:13:57 +0100
Subject: [Gambas-user] Pointer-Memory Question
> 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
>
> ------------------------------------------------------------------------------
> 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 at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
------- End of Original Message -------
More information about the User
mailing list