CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Convert int to char

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 6, 2010, 11:39
Default Convert int to char
  #1
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
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
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   April 6, 2010, 12:28
Default
  #2
Senior Member
 
Join Date: Nov 2009
Posts: 411
Rep Power: 20
DoHander is on a distinguished road
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
DoHander is offline   Reply With Quote

Old   April 7, 2010, 16:04
Default
  #3
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Thank you! sprintf() was the right approach!
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFOAM-1.5-dev svn revision 1438: libOpenFOAM does not compile in SP 4xF OpenFOAM Bugs 3 October 16, 2009 06:35
Error with Wmake skabilan OpenFOAM Installation 3 July 28, 2009 01:35
Missing math.h header Travis FLUENT 4 January 15, 2009 12:48
Statically Compiling OpenFOAM Issues herzfeldd OpenFOAM Installation 21 January 6, 2009 10:38
int to char in UDF Paolo Lampitella FLUENT 3 December 11, 2008 05:01


All times are GMT -4. The time now is 20:34.