07-30-2013 06:19 AM
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
Solved! Go to Solution.
07-30-2013 06:47 AM
The basic insight is that CVI is based on C
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 ();
07-30-2013 06:55 AM
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?
07-30-2013 07:08 AM
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
07-31-2013 06:14 AM
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);