Buchempfehlung
MySQL kurz & gut
MySQL kurz & gut
Das preiswerte Taschen- buch stellt MySQL-rele- vante Inhalte systematisch und knapp dar, sodass es sich optimal zum Nach- schlagen beim Pro- grammieren eignet. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

Store pointer in UDT

Uploader:AdministratorSebastian
Datum/Zeit:12.05.2013 13:25:03

TYPE tNebulaPolygon
    objectName As String
    numCoordinates As Integer
    coordinates As Integer Ptr
END TYPE


DIM x AS tNebulaPolygon

x.objectName = "Big green nebula"
x.numCoordinates = 100
x.coordinates = CAllocate(SizeOf(Integer) * x.numCoordinates * 2)

Dim As Integer ptr currentPointer = x.coordinates
Dim As Integer i

Randomize Timer
For i = 1 To x.numCoordinates*2
    *(currentPointer) = Int( Rnd * 1000 )
    currentPointer += SizeOf(Integer)
Next i


' Data generation finished.

' Display data:
Print "Coordinates of " & chr(34) & x.objectName & chr(34)
Dim As Integer cx, cy
currentPointer = x.coordinates 'Beginning of buffer
For i = 1 To x.numCoordinates
    cx = *(currentPointer)
    currentPointer += 4
    cy = *(currentPointer)
    currentPointer += 4
    PRINT "Pair " & i & ": (X,Y) = (" & cx & "," & cy & ")"
Next i

Sleep