My app uses a function that has a LPWSTR as
parameter.After calling this function, I need to convert
this LPWSTR to an array of char.
Example:
LPWSTR lpStr;
char cTest[200];
foo(lpStr,200); //returns a result in lpStr
cTest=lpStr; //here I don't know how convert LPWSTR to char
Can someone please help me? I already checked
WideCharToMultiByte, but I don't know if its the right way
as I can't convert it with this function either (I always
get a Systemerror 1004). Thanks to all!
LPWSTR w = L"Hello";
char c[10] = {0};
wcstombs(c, w, wcslen(w));
- Junkie
"Dave McZui" <da...@spam.com> wrote in message
news:04df01c2ccb1$91cb6960$d4f82ecf@TK2MSFTNGXA11...
> Hello!
>
> My app uses a function that has a LPWSTR as
> parameter.After calling this function, I need to convert
> this LPWSTR to an array of char.
> Example:
> LPWSTR lpStr;
> char cTest[200];
>
> foo(lpStr,200); file://returns a result in lpStr
>
> cTest=lpStr; file://here I don't know how convert LPWSTR to char
"Dave McZui" <da...@spam.com> wrote in message
news:04df01c2ccb1$91cb6960$d4f82ecf@TK2MSFTNGXA11...
Its helpful to check what error code means.
In VC++ choose "Tools menu -> Error Lookup" then write the error code you
got. This will make things more clear for you, for example the error code
you got(1004) means "Invalid flags." so obviously you used wrong flags when
calling WideCharToMultiByte.
--
Regards,
Kobi Ben Tzvi
"Dave McZui" <da...@spam.com> wrote in message
news:04df01c2ccb1$91cb6960$d4f82ecf@TK2MSFTNGXA11...