LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I convert an integer to a string in CVI?

Is there a function in CVI comparable to itoa in MS C?
0 Kudos
Message 1 of 4
(13,808 Views)
sprintf

"Double_D" wrote in message
news:506500000008000000834D0000-1023576873000@exchange.ni.com...
> Is there a function in CVI comparable to itoa in MS C?
0 Kudos
Message 2 of 4
(13,807 Views)
The easiest way to do this is to use the Fmt function. This is included in the Formatting and I/O Library in CVI. These are very powerful functions. See the function panel to get more help for this function. Here is some example code which converts an integer to a string:

int num = 20;
char *word[10];

Fmt (word, "%d", num);

Now the character array 'word' holds the string "10". This automatically null terminates the string also.
J.R. Allen
0 Kudos
Message 3 of 4
(13,807 Views)
Remember to place the following header:

#include "<" formatio.h ">"


The quotes around the brackets are to fool the html parser...

Message Edited by JoeLabView on 04-15-2005 10:42 AM

Message 4 of 4
(13,754 Views)