¿Cómo puedo convertir el tipo LPSTR a WCHAR?
He probado con:
WCHAR aux[MAX_PATH];
swprintf(aux, L"%s", MiVariableLPSTR);
pero el valor que toma aux es un carro de símbolos y caracteres raros...
Gracias de antemano.
Vale, yo mismo me respondo por si a alguien le sirve la respuesta...
WCHAR aux[MAX_PATH];
swprintf(aux, L"%S", MiVariableLPSTR);
encontrais la diferencia? l S mayuscula de L"%S", alguien me puede explicar la diferencia entre s y S?
Gracias
Cita de: "SkyNetBCN"Vale, yo mismo me respondo por si a alguien le sirve la encontrais la diferencia? l S mayuscula de L"%S", alguien me puede explicar la diferencia entre s y S?
Citar
// Sobre modificador l (ele)
l (ell) long unsigned long long *
// l en caracteres y cadenas
Modifier c s
l (ell) wint_t wchar_t *
// Sobre S mayúscula
S Treated as s with the l (ell) modifier.
// Sobre s minúscula
s The char * argument is expected to be a pointer to an array of
character type (pointer to a string) containing a multibyte
sequence. Characters from the array are converted to wide char-
acters and written up to (but not including) a terminating NUL
character; if a precision is specified, no more than the number
specified are written. If a precision is given, no null charac-
ter need be present; if the precision is not specified, or is
greater than the size of the array, the array must contain a ter-
minating NUL character.
If the l (ell) modifier is used, the wchar_t * argument is
expected to be a pointer to an array of wide characters (pointer
to a wide string). Each wide character in the string is written.
Wide characters from the array are written up to (but not includ-
ing) a terminating wide NUL character; if a precision is speci-
fied, no more than the number specified are written (including
shift sequences). If a precision is given, no null character
need be present; if the precision is not specified, or is greater
than the number of characters in the string, the array must con-
tain a terminating wide NUL character.
De MacOs man pages:
http://www.hmug.org/man/3/swprintf.phpTambién puedes leer de Unix:
http://www.opengroup.org/onlinepubs/007908...h/fwprintf.html(S Same as ls)
Mira esta funcion de windows:
MultiByteToWideCharEjemplo:
char normal[16];
WCHAR wide[16];
MultiByteToWideChar( CP_ACP, 0, normal, -1, wide, 16 );