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

Problem printing doubles

Anonymous
Not applicable
Hello

I’m printing variables using acapi_writereport..
Today I just couldn’t print doubles. Whenever I print a double (using %d), it just gives me huge random numbers.. not even doubles (without . In the number)
For testint I even tried to set double t=0.1 and then to print it, it was still a huge number.. it used to be fine so all I can guess is to delete cache files/refresh things or something like this..

Thanks..
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Akos Somorjai
Graphisoft
Graphisoft
Hi,

%d is for printing integers, please use %g or %f for that. You can even specify the number of decimals (2 in this example): %5.2f

Best, Akos

View solution in original post

3 REPLIES 3
Solution
Akos Somorjai
Graphisoft
Graphisoft
Hi,

%d is for printing integers, please use %g or %f for that. You can even specify the number of decimals (2 in this example): %5.2f

Best, Akos
Anonymous
Not applicable
Thanks.. Is there a document that sums those things up? Maybe a guide on the best way to debug?
Erenford
Booster
Tomer1 wrote:
Thanks.. Is there a document that sums those things up? Maybe a guide on the best way to debug?
just do a web search for "printf format"
https://en.wikipedia.org/wiki/Printf_format_string
http://www.cplusplus.com/reference/cstdio/printf/
Archicad 25 5010 INT FULL
Archicad 26 5002 INT FULL
Visual Studio Professional 2019
Win 10 Pro 64-bit

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!