Is there a way to get the name of a structure after it has been created? In the following, could I somehow get "MyStructure" from *test?
Code: Select all
Structure MyStructure
name.s
EndStructure
Define *test.MyStructure
Code: Select all
Structure MyStructure
name.s
EndStructure
Define *test.MyStructure
Code: Select all
;-TOP
Structure udtMyStruct
iVal.i
fVal.f
dVal.d
sVal.s
EndStructure
Define MyStruct.udtMyStruct
If CreateXML(0)
InsertXMLStructure(RootXMLNode(0), @MyStruct, udtMyStruct)
FormatXML(0, #PB_XML_ReFormat)
Debug ComposeXML(0)
EndIf
If CreateJSON(0)
InsertJSONStructure(JSONValue(0), @MyStruct, udtMyStruct)
Debug ComposeJSON(0, #PB_JSON_PrettyPrint)
EndIf
Code: Select all
EnableExplicit
Structure MyStructure
name.s
EndStructure
Global *test.MyStructure
Macro mAllocMyStructure(ptr)
ptr = AllocateStructure(MyStructure)
ptr\name = "MyStructure"
EndMacro
mAllocMyStructure(*test)
Debug *test\name
The only thing you can find out about a structure is it's size, using the SizeOf compiler function: https://www.purebasic.com/documentation ... tions.htmlwombats wrote:Hi,
Is there a way to get the name of a structure after it has been created? In the following, could I somehow get "MyStructure" from *test?Code: Select all
Structure MyStructure name.s EndStructure Define *test.MyStructure