LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

storing double in registry

How does one do this? I am using registry functions available as part of
toolbox innstrument driver.
0 Kudos
Message 1 of 3
(3,032 Views)
Seems unsigned longs are the only way, so will have to convert my doubles to
ints.

vishi

"Vishi Anand" wrote in message
news:3e52a4c0@newsgroups....
> How does one do this? I am using registry functions available as part of
> toolbox innstrument driver.
>
>
>
>
0 Kudos
Message 2 of 3
(3,032 Views)
You can store a double in the registry as a string.

e.g.
sprintf((char *)buffer, "%f", (float)dval);
error = RegWriteString (userRootKey, userSubKeyName, userValName, buffer);

and read with:
error = RegReadString (userRootKey, userSubKeyName, userValName, buffer, 256, &realSize);
if (!error) sscanf((char *)buffer, "%f", &fval);

But you may have to be careful if you are really worried about precision. I am not sure what the maximum string length can be.

Paul.
0 Kudos
Message 3 of 3
(3,032 Views)