CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   Convert int to char (http://www.cfd-online.com/Forums/fluent-udf/74678-convert-int-char.html)

sega April 6, 2010 10:39

Convert int to char
 
Hello world.

I haven't found a way of converting an int value to a char-string.
Is that possible with FLUENT UDF's?!

sega

DoHander April 6, 2010 11:28

Try to use sprintf.
Example:

char a[100];
sprintf(a,"%d",1002);

-------------------------------------------------

Now you should have in "a" 1002 as a string. I didn't actually test my above code, so you can expect to have some problems adapting this to a UDF.

Do

sega April 7, 2010 15:04

Thank you! sprintf() was the right approach!


All times are GMT -4. The time now is 19:33.