[Gambas-user] Pointer-Memory Question

Wally wally at ...2037...
Fri Feb 3 15:13:57 CET 2012


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




More information about the User mailing list