Results 1 to 6 of 6

Thread: Dynamic Nested Type Structures?? HELP!!!!

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    Unhappy

    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

  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    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

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770
    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.

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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
  •  



Click Here to Expand Forum to Full Width