11-26-2005, 02:37 AM
Pages: 1 2
11-26-2005, 03:06 AM
Well, there you go syn. Heh, didn't think to look up C functions.
11-26-2005, 07:15 AM
Quote:If you dimension an array using (20), it will dimension index 0 to 20, giving 21 subscripts.
Thanx that is new for me.
In other basic
dim a(1) as integer will make an array with one element on index 0
and
dim a(1 to 1) as integer will make an array with one element on index 1
Joshy
11-26-2005, 04:56 PM
ok so I am trying to copy map data to temp map data array and then back again if there is an error witht he file, I am getting an out of array bounds. I am still trying to figure out what is going wrong, but can someone tell me if I am using memcpy correctly?
Code:
text$ = input_text(font, "Load What File?",CENTER,display.max_y/2, colour_1)
redim temp_array(1 to UBOUND(map_array,1)+1, 1 to Ubound(map_array,2)+1)
memcpy (@temp_array(0,0), @map_array(0,0), (len(sizeof(map_array))*(ubound(map_array,1)*ubound(map_array,2))))
If (load_map(map_array(),text$)) then
memcpy (@map_array(0,0), @temp_array(0,0), (len(sizeof(map_array))*(ubound(map_array,1)*ubound(map_array,2))))
display_text_solid(font,"*WARNING* File could not be opened",CENTER,display.max_y/2 + 40, colour_2)
SDL_Flip (video)
SDL_Delay 2000
end if
Anonymous
11-26-2005, 07:22 PM
I don't think you can use UBound on multi-dimensional arrays. I'd post on freebasic.net forums to make sure on that one.
11-26-2005, 07:31 PM
Quote:I don't think you can use UBound on multi-dimensional arrays. I'd post on freebasic.net forums to make sure on that one.it works, i looked it up in the FB .chm
Anonymous
11-26-2005, 08:13 PM
youre dimming temp_array from "1 to ..." and then memcpy'ing from 0.
id suggest ALWAYS dimming arrays from index 0.
id suggest ALWAYS dimming arrays from index 0.
Pages: 1 2