Argh... of course: This uses internal counter: iA = Read #hMemory As Integer
This uses pPointer as address: iA = Integer@(pPointer) Jussi On Sat, Jan 8, 2011 at 20:40, Jussi Lahtinen <jussi.lahti...@gmail.com>wrote: > Behaviour confirmed with Gambas 3 rev 3447 @ Ubuntu 10.10 64bit. > Though I don't think this is bug, since stream pointer position moves after > write. > "Seek #hMemory, 0" will fix that, in this case. See more from documentation > of Seek. > > However I don't know how Interger@ gets correct position... > > Jussi > > > > > > On Sat, Jan 8, 2011 at 18:09, Demosthenes Koptsis > <demosthen...@gmail.com>wrote: > >> >> But if i write, >> >> iA = Integer@(pPointer) >> Print iA >> >> then iA gets the value 10. >> >> why is that? >> >> what's the difference between >> iA = Read #hMemory As Integer >> iA = Integer@(pPointer) >> >> ? >> -- >> Regards, >> Demosthenes Koptsis. >> >> >> ---------- Forwarded message ---------- >> From: Demosthenes Koptsis <demosthen...@gmail.com> >> To: Gambas User List <gambas-user@lists.sourceforge.net> >> Date: Sat, 08 Jan 2011 10:32:12 +0200 >> Subject: Gambas3 Pointers example >> Hello, >> i remake an example for pointers in Gambas3-svn3432, ubuntu 10.04 LTS, >> AMD64 >> >> The example is the next: >> >> ------------------------- >> ' Gambas module file >> >> Public Sub Main() >> >> Dim pPointer As Pointer >> Dim hMemory As Stream >> Dim iA As Integer >> >> pPointer = Alloc(SizeOf(gb.Integer)) >> hMemory = Memory pPointer For Read Write >> >> Write #hMemory, 10 As Integer >> iA = Read #hMemory As Integer >> >> Print iA >> >> Free(pPointer) >> >> End >> ------------------------- >> >> the iA var when it prints is not 10 but something else like 0 or 32621 >> or similar. >> >> What am i doing wrong? >> >> >> >> -- >> Regards, >> Demosthenes Koptsis. >> >> >> ------------------------------------------------------------------------------ >> Gaining the trust of online customers is vital for the success of any >> company >> that requires sensitive data to be transmitted over the Web. Learn how >> to >> best implement a security strategy that keeps consumers' information >> secure >> and instills the confidence they need to proceed with transactions. >> http://p.sf.net/sfu/oracle-sfdevnl >> _______________________________________________ >> Gambas-user mailing list >> Gambas-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-user >> >> > ------------------------------------------------------------------------------ Gaining the trust of online customers is vital for the success of any company that requires sensitive data to be transmitted over the Web. Learn how to best implement a security strategy that keeps consumers' information secure and instills the confidence they need to proceed with transactions. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user