What I'm doing is taking from user input a decimal number (GetWindowTextW) to a char array (wcstombs) to a double (strtod) and then through a function, do a calculation to return a double value (let's just say it's (double a+ double b)). Now, I want to take that double value and output it on my Window so the user can see the result, and I can't figure out how to do this. Everything I've researched on how to accomplish this is either wrong or doesn't work with Pelles or more likely I'm just doing something wrong. Here is the function I have in order to attempt this:
wchar_t *ConvertDoubleToWchar(double value)
{
wchar_t ValOut[10];
char ValueResult[10] = {0};
snprintf(ValueResult, 10, "%.3f", value);
swprintf(ValOut, 10, L"%hs", ValueResult);
return ValOut;
}
But when I try to implement as such: CreateWindowW(L"Static", *ConvertDoubleToWchar(double value) etcetc..., no value appears on the window. It's always blank. Is this a casting issue on my part? I've tried so many things to try to get this to work that I've lost track of them. My code compiles, but it just won't display the double value that I'm going for.