LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting A Double To A String

In LabWindows CVI, is there a way to convert a double data type into a string?
0 Kudos
Message 1 of 5
(4,229 Views)
You can do something like this.

double number;
char string[256];

sprintf(string, "%f", number);

Sheetal
Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 2 of 5
(4,226 Views)
Thanks Sheetal. I'll give that a try.
0 Kudos
Message 3 of 5
(4,217 Views)
Hello,

You can use sprintf, but the limitation of this function is that you will need to know how long your double is:

double num;
char str[length of double];

sprintf(str, "%2f", num);


If you want to convert an array of doubles to an array of characters, you could also use the function ConvertArrayType() in the Programmer's Toolbox.


Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 4 of 5
(4,214 Views)
What I was converting isn't an array of doubles. It is just a plain double data type. So I'm not too sure if the ConvertArrayType()function would work in this case. Thank you anyway for your response. I appreciate the help.
0 Kudos
Message 5 of 5
(4,207 Views)