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

Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi Daiszy,

Someone had the same issue like you have in this topic: https://Archicad-talk.Graphisoft.com/viewtopic.php?f=23&t=68038

I answered it there:
Tibor wrote:
Hi,

This should work:
GS::uchar_t bufferUStr[API_UAddParStrLen];
GS::ucsncpy (bufferUStr, GS::UniString (line.c_str()).ToUStr().Get(), API_UAddParStrLen - 1);
chgParam.uStrValue = bufferUStr;
Just make sure, that bufferUStr will live till you use the chgParam

A little explanation:
uStrValue is a simple pointer, it just points to somewhere. That's why you cannot write characters into it and you got crash report immediately. You have to set the pointer to an existing array of characters.
0 REPLIES 0
Learn and get certified!