Home | Reviews | GUIpedia | Forum | Fun500

BrandonUsing REDIM
Is it possible to use REDIM in a sub in FreeBASIC? For my sidebar I want the number of groups to be dynamic, it'd be better if I didn't have to force a set limit or somehow redim at launch. Does anyone have experience with redim?
2009-12-0510:00 AM

ToddRe:Using REDIM
I know you can REDIM from the program. You may have to make the array SHARED in order to REDIM from a SUB or FUNCTION. Write a little program in FB to see if it works.
2009-12-0512:58 PM

BrandonRe:Using REDIM
I tried that, it says something about not being able to redim in a sub if I use "REDIM SHARED" or something about the variable already existing if I don't use SHARED with REDIM.
2009-12-051:17 PM

pharoahRe:Using REDIM
You could implement my list thing... it's pretty easy to change the size of a string from within a sub :).
2009-12-054:41 PM

ToddRe:Using REDIM
Or try a binary tree or linked list.
2009-12-055:53 PM

pharoahRe:Using REDIM
Oh, this is FreeBASIC? Yeah, might as well use a linked list. There are a few implementations out there, search the FB forum.
2009-12-056:38 PM

BrandonRe:Using REDIM
Yeah, I'm trying to start work on Fun500 6.
2009-12-056:49 PM

ksrRe:Using REDIM
I've had this issue before. Post your code, mine looks like this: global code [code]dim shared as file db()[/code] function code [code] redim preserve as file db(newsize) [/code]
2009-12-064:29 PM

BrandonRe:Using REDIM
I'll look at it again tomorrow, today I spent a lot of time looking in the CPU section here: http://redhill.net.au/ig.html It's quite informational.
2009-12-065:29 PM


2021 Brandon Cornell