cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
poco2013
Mentor

ACAPI_WrieReport Format

My add on uses a Alert message via the WriteReport function. I want to format the output message using some embedded variables. but the place holder %s does not seem to work for UniStrings. does work for %f & %d.

AS in:
GS:: UniString str = 'something';
ACAPI_WriteReport ( "message is  %s" , true,  str ); // does not work. returns no conversion error.
however, i can use str directly without a conversion if no format place holder is used. Is there a solution or a conversion?
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
1 Solution

Accepted Solutions
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
poco2013 wrote:
Is there a solution or a conversion?
Use the ToCStr method of GS::UniString:
GS::UniString str = "something";
ACAPI_WriteReport ("message is %s", true, str.ToCStr ().Get ());

Go to post

3 Replies 3
leilei
Enthusiast
Hi,
I use this:

GS::UniString successexport;
successexport +="hello";
successexport +="world";
ACAPI_WriteReport(successexport,true);
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
poco2013 wrote:
Is there a solution or a conversion?
Use the ToCStr method of GS::UniString:
GS::UniString str = "something";
ACAPI_WriteReport ("message is %s", true, str.ToCStr ().Get ());
poco2013
Mentor
Thanks all and thanks Tibor -- I was missing the get() part of ToCstr()
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

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!