Archicad C++ API
About Archicad add-on development using the C++ API.

Problem about GS::uchar_t

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",;
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.

Ralph Wessel
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

Not applicable
It's work !
Thank you very much.

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!