Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Arrays In User Data Types
#1
Hello everyone,

I'm not sure if this question has been asked before and if so my apologies.  I tried searching online for the topic but those solutions weren't necessarily applicable to what I'm looking for.  I'm working on a program for practice where I take a text file, read and parse the data into an array, then save the array to my own custom binary file.  This task is tricky in most languages but a breeze in C as far as creating a struct that contains an array that can be written to or read from a binary file.  But with QB when I try this code for example I get an error:

Type MyPalette
HeaderTag as String
    Colors(20) As integer

End Type

For as long as I've been coding off and on in Basic and QB especially I didn't know you couldn't simply create a fixed array in a custom data.  With binary files I'll typically create a data type with a header and variables where each variable in succession including large chunks of data can be organized into a contained array so I can write the entire custom data type to a binary file with one line of code.  Is this even possible with QB or is there any type of workaround?  I did glance at the new _MEM command but not too familiar with that either.

Thanks for reading and your input.
Reply


Messages In This Thread
Arrays In User Data Types - by Consolemu - 01-18-2024, 08:30 PM
RE: Arrays In User Data Types - by justsomeguy - 01-18-2024, 09:11 PM
RE: Arrays In User Data Types - by bplus - 01-18-2024, 09:49 PM



Users browsing this thread: 1 Guest(s)