AllocateStructure()
语法
*Item.StructureName = AllocateStructure(StructureName)概要
Allocates a new dynamic structure item. This dynamic structure item is properly initialized and ready to use, without the need to call InitializeStructure(). To access the structure data, a pointer associated with the specified 'StructureName' has to be used.
参数
StructureName The name of the structure used to create the new dynamic item. The structure has to be already created.
返回值
The address of the new dynamic structure item, zero otherwise.
Remarks
This command is for advanced users and shouldn't be needed for most of programs. It's often a better choice to use a structured array, list or map to store dynamic structured items.
FreeStructure() can be used to free the dynamic structure item. All dynamic structures are automatically freed when the programs ends.
If the program crashes at this command, it is usually a result of a memory corruption at an earlier time in the program by writing at an area outside of the allocated memory area. Such an error can be narrowed down to the real cause using the purifier debugger tool.
示例
Structure People Name$ List Friends$() EndStructure *DynamicPeople.People = AllocateStructure(People) *DynamicPeople\Name$ = "Fred" AddElement(*DynamicPeople\Friends$()) *DynamicPeople\Friends$() = "Stef" Debug *DynamicPeople\Name$ Debug *DynamicPeople\Friends$() FreeStructure(*DynamicPeople)
参阅
FreeStructure()
已支持操作系统
所有