BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Archicad C++ API
About Archicad add-on development using the C++ API.

Problem about GS::uchar_t

Anonymous
Not applicable
I try to use API Dev 11 to develop my Add-on. And I found that GSRoot Document (come with API Dev 11) is out-of-date. I can not find any method (fuction) to work with GS::uchar_t ( such as GS::ucscpy ...). So I must try some code in an example.
I can use some example-code to develop Add-on that can change 'realValue' parameter of my Object. But when I try to change 'uStrValue' parameter using code like ...
CHCopyC ("Dir", chgParam.name);
GS::UniString tmpUStr ("Left");
GS::ucscpy (chgParam.uStrValue, tmpUStr.ToUStr());
My ArchiCAD will be crash !
How can I solve this problem and how can I find document about GS::uchar_t ?
Thank you
Hemmachart R.
2 REPLIES 2
Ralph Wessel
Mentor
Hemmachart wrote:
GS::ucscpy (chgParam.uStrValue, tmpUStr.ToUStr());
My ArchiCAD will be crash !
'uStrValue' is a pointer in 'API_ChangeParamType'. You can't simply copy characters to the address it points to without allocating space for the string. You are probably writing to a spurious/random/null location, which explains the crash. Try setting 'uStrValue' to a pointer to the string already allocated in 'tmpUStr'.
Ralph Wessel BArch
Anonymous
Not applicable
It's work !
Thank you very much.
Hemmachr
Learn and get certified!