I'm working on an application that needs to store a data value of type double to the registry. I'm using MFC but the only functions in "theApp" that I see for doing the job (from the searching that I've done) are GetProfileIntW
, GetProfileStringW
and GetProfileBinary
. What would be the best way to store and retrieve the data while keeping as much precision as possible?
The GetProfileBinary function is the only reasonable choice. Using a string would mean doing conversions and using an int would lose precision in many cases.
double *pMyDouble;
UINT size = sizeof(*pMyDouble);
GetProfileBinary(sectionName, valueName, (LPBYTE *)&pMyDouble, &size);
double myDouble = *pMyDouble;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.