Question:
After a structure is defined witha “TYPE” declaration, do you know of a way to directly fillthe structure with data, rather than individually assigingthe elements, or reading from a file? I haven’t seen anyway in either the manuals, or in 4 different after marketreference books that I have.
Answer:
Note: This answer came from the person who asked the question.
I used the code:
TYPE StructType ‘/* setup stucture of type char */ a AS STRING * 1 b AS STRING * 1 c AS STRING * 1 d AS STRING * 1 END TYPE DIM Structure as StructType ‘/* find the address of the first element */ ptrData& = VARPTR(Structure) ‘/* then, if I know the structure elements size, */ ‘/* I can POKE data into them */ Test$=”1234″ ‘/* place the ASCII representation of each char into structure */ for i% = 1 to len(Structure) POKE i% + ptrStructure& – 1, ASC(MID$(Test$,i%,1)) NEXT ‘/* display the elements */ PRINT CHR$(Structure.a) PRINT CHR$(Structure.b) PRINT CHR$(Structure.c) PRINT CHR$(Structure.d)
Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.
Related Posts
- Multithreading in Python
- Find Compilation Time (in nanosecond, microsecond & millisecond) of any code (C, C++, JAVA & all others) & Execution Time of any Command
- Validate Arguments via Google Guava
- Cloud and Hybrid Application Lifecycle Management with OneOps
- 3 Options for Capturing Heap Dump from an Android App























