Posts: 42
Threads: 14
Joined: Dec 2004
I need to create several bitmaps in Allegro, but declaring all of them seperately would take forever. How could I use the []'s in bitmap pointers? Example:
DIM pic[256] AS BITMAP ptr
It comes up with an error because of the []'s. I have seen them used in the starfields demo for allegro. How could I use those?
Posts: 3,279
Threads: 170
Joined: Nov 2003
Might wanna try using () instead of []. [] has another purpose in FB. You can't directly port C code to FB.
I'd knock on wood, but my desk is particle board.
Posts: 922
Threads: 15
Joined: Jun 2003
[]'s are only used for pointer indexing, () should be used to declare and access arrays, array[idx] is a shortcut for *(array + idx).
Posts: 133
Threads: 19
Joined: Jan 2005
Quote:[]'s are only used for pointer indexing, () should be used to declare and access arrays, array[idx] is a shortcut for *(array + idx).
If i understand you right i can declare the following:
dim shared somestring as string ptr
and retrive singel chars out of it thne c way?
eg.: sometring[4] = mid$(somestring,4,1)
So Long, The Werelion!
color=red]Look at you, Hacker. A pathetic creature of meat and bone, panting and sweating as you run through my corridors. How can you challenge a perfect, immortal machine?" - Shodan, AI at Citadel Station orbiting Earth[/color]
Posts: 922
Threads: 15
Joined: Jun 2003
Nope, STRING is actually a descriptor, [] will access the descriptor, not the data, but you could do:
Code:
dim shared somestring as byte ptr
somestring = strptr("abc")
i = 0
do while somestring[i] <> 0
print chr$( somestring[i] );
i = i + 1
loop