LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get a value with a pointer to void from the GetCtrlVal-function??

I'd like to get a value from the GetCtrlVal-function with a pointer to void and pass it to the SetCtrlVal-function. Does this work and how do I have to pass the pointer to the function??
0 Kudos
Message 1 of 3
(3,073 Views)
Andy,

All you need to do is cast the pointer to the appropriate type when passing it arround. Here is a small example:

void *temp;
temp = malloc(sizeof(double));
GetCtrlVal (panelHandle, PANEL_BPM, (double *)temp);
DebugPrintf("The value is...%f", *((double *)temp));
SetCtrlVal (panelHandle, PANEL_BPM, *((double *)temp));
free(temp);


Make sure that you allways have the required memory space allocated for the data type that you are using.

Hope that helps.

Regards,

Juan Carlos
N.I.
Message 2 of 3
(3,073 Views)
Thanks for your help, it works.
0 Kudos
Message 3 of 3
(3,073 Views)