set_struct_field

Definition: include cffi.e
set_struct_field(integer id, atom pStruct, string fieldname, atom v)
Description: set a named field in a structure previously allocated by allocate_struct().
Comments: The parameter v is an atom. You may need to use allocate_string(), allocate_struct(), or allocate() to set lpsz and other pointer members, and call free() once the memory is no longer needed.
Example:
include cffi.e
constant idMBP = define_struct(...)
atom pMBP = allocate_struct(idMBP)
..
atom pTitle = allocate_string("title")
atom pCaption = allocate_string("caption")
set_struct_field(idMBP,pMBP,"lpszText",pTitle)
set_struct_field(idMBP,pMBP,"lpszCaption",pCaption)
set_struct_field(idMBP,pMBP,"dwStyle",MB_OK)
..
free(pCaption)
free(pTitle)
See Also: allocate_struct, allocate_string, allocate, free