LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Display Double in .uir text message

Solved!
Go to solution

Hello everyone,

I am quite new in LabWindows/CVI, but I have already managed to built quite big software.

I have a difficulty with displaying double varible in text message on one of my .uir Panels.
Problem is that I do not know how to transform double varible into string or char[].
I have not found similar topis, so thats why I wrote.

I am using:

SetCtrlVal(panelHandleCH75,CH75_vrefb_disp, ... );

 

and as a 3rd varible to this function should be  string made of double varible vrefb ( format "%1.3f").

I would be gratefull for help.
Thanks in advance

Best

Chris

0 Kudos
Message 1 of 5
(3,933 Views)

The basic insight is that CVI is based on C Smiley Happy

Hence you can use the standard formatting functions of ANSI C such as sprintf; you can also use some library functions provided by CVI such as Fmt ();

0 Kudos
Message 2 of 5
(3,930 Views)

I have tryed to use sprintf, but it trows a fault abou pointer to chr  while i have pointer to char[].
I am probably using it in a wrong way.
How would you use it?

0 Kudos
Message 3 of 5
(3,926 Views)
Solution
Accepted by BiedaK

You can use the Interactive Execution window to test it quickly. The following example works:

 

static char string [ 20 ];

static double liter = 1.55;

sprintf (string, "%.2f Liter\n" ,liter);

 

Please note that this a forum about CVI, not C Smiley Wink

0 Kudos
Message 4 of 5
(3,923 Views)

Yes,  easy problem in C.
I thought that CVI uses there something else.

 

I maganed:

//char falpha[128];
//float f = 0.44f;
//sprintf(falpha,"%0.2f",f);

0 Kudos
Message 5 of 5
(3,890 Views)