Workarounds for StructPut/StructGet limitations
pb
I could, I suppose, write my own routine that writes the STRUCT data to some sort of string using, say, keyword-value pairs, but this sounds miserable and totally pointless, as it will erase many of the benefits of using STRUCTS in the first place.
A previous node dealt with writing a "complicated" structure to a string, but there is no way to read that string back into the structure (as far as I'm aware):
http://www.igorexchange.com/node/1028
Thanks!
Nick
However, if you give more detail about what you're trying to accomplish (ie. why you need to read and write complicated structures to a string) you might get some ideas of how to do what you want to do in a different (and maybe better) way.
May 6, 2009 at 02:50 pm - Permalink
char text[32]
int32 i32
EndStructure
Structure TestStruct
char text[32]
int32 i32
STRUCT TestSubStruct subStruct
EndStructure
Function Test()
STRUCT TestStruct s1
s1.text = "This is a test"
s1.i32 = 1234
s1.subStruct.text = "Another test"
s1.subStruct.i32 = 4321
Print s1
String str
StructPut/S s1, str
STRUCT TestStruct s2
StructGet/S s2, str
Print s2
End
You can store strings using char fields as shown above.
May 9, 2009 at 12:54 am - Permalink