I need to convert from char* to wchar. Here is how i am doing.
char * retrunValue= getData();
size_t origsize = strlen(returnValue) + 1;
const size_t newsize = 200;
size_t convertedChars = 0;
wchar_t wcstring[newsize];
mbstowcs_s(&convertedChars, wcstring, origsize, returnValue, _TRUNCATE);
wcscat_s(wcstring, L" (wchar_t *)");
getData() function returns a char* value for example "C:/Documents and Settings" when i tried to print the converted value "wcstring": the value is not correct: it is something like this "C:/Documen9" or something garbage. 1- Please tell me is it safe to convert from char* to wchar in this way, as i am doing 2- How can i get the original value as returned by getData() function
Thanks, Regards
UPDATE:
size_t origsize = strlen(returnValue) + 1;
const size_t newsize = 200;
size_t convertedChars = 0;
wchar_t wcstring[newsize];
wsprintf(wcstring, newsize, L"%S (wchar_t *)", returnValue);
added this but it says. "argument of type "size_t is incompatible with parameter of type "LPCWSTR" "