|
-
Sep 26th, 2000, 08:40 PM
#1
Thread Starter
Fanatic Member
Im trying to make a dynamic nested Type stucture like this.
Type Var2_t
End Type
Type Var1_t
Stuff() As Var2_t
End Type
Dim Var1() As Var1_t
I can't figure out how to redim this.
I tryed:
ReDim Var1(number).Stuff(number)
But it doesn't work. When i fill the Type with values from a File it says "Out of memory". But if i was to make the
Stuff() Array fixed: stuff(314), it works just fine!
I want the Types to be dynamicly redim.
I hope you can help, i have been triying to figure this out for a while now.
Thanks
-
Sep 26th, 2000, 10:00 PM
#2
Hyperactive Member
Yeuck... Very messy.
If I were you I would turn the whole thing into Classes and use Collections to store dynamic iterations of the sub-clases.
But thats just me
-
Sep 27th, 2000, 04:35 AM
#3
transcendental analytic
What´? There's nothing wrong with nkads Type structure.
the "Out of memory" prob has occurred to me a month ago in a similar procedure. Actually it's not out of memory but that you read the UDT from the wrong position. The dynamic array inside the type is written with a 2 byte descriptor that is also read from a specific point in the file. When the file is corrupted or your writing procedure doesn't match the reading procedure, then the descriptor will get incorrect information and cause out of memory. Best solution is to look trough your code.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Sep 27th, 2000, 12:22 PM
#4
Thread Starter
Fanatic Member
Actually kedaman, I am reading from the appropriate byte offset in the file. When I try to ReDim my array structures I get "Out of Memory". Actually what this is for is a Quake2 model viewer. It works to! Just not this.
Regarding using classes and collections, I really dont think that would work because the file is structured a certain way.
I dont know. I might just convert this into C, put it in a DLL and just be done with it.
-
Sep 27th, 2000, 12:55 PM
#5
Monday Morning Lunatic
Although, with C, be very careful with your alignment. It's capable of destroying your program completely, and you have no idea where it comes from.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 28th, 2000, 02:46 AM
#6
transcendental analytic
Well, then there could of course be the real "Out of Memory" cause. Maybe you have too many apps running or your vb project is too large, since redimming type structure works just fine for me on any comp. I guess you could isolate and run that part of your app independently, or maybe you could just emulate that in a new project.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|