The name of a structure created with a DECLARESTRUCT definition. Character
Optional. Default = Null. The data to put into the structure.
STRUCT_SET() creates a packed structure based on a DECLARESTRUCT definition, and optionally reads blob data to initialize the packed structure. This is useful for interpreting binary data read in from files.
This following snippet of code reads the bitmap header structure from a bitmap file declare into the bitmap file header structure.
declarestruct BITMAPFILEHEADER C2Type, L1Size, W2Reserved, L1OffBits ? name of bitmap file is stored in a character variable dim shared bitmapfilename as C ? open the bitmap file f = file.open(bitmapfilename, FILE_RO_SHARED) ? use STRUCTURE_SET with no blob to create a structure bitmapfile = struct_set("BITMAPFILEHEADER") ? which we then use to create a blob bitmapfiledata = struct_get(bitmapfile) ?which we use to determine the size we need to read bitmapfiledata = f.readb(bitmapfiledata.size() ) ? convert the blob to the structure bitmapfile = struct_set("BITMAPFILEHEADER", bitmapfiledata) ? close the file f.close()