c - Printing a wchar_t gives weird output -


running code snippet:

wchar_t *wstr = l"áßå®"; wprintf(l"%s",wstr); 

gives output:

«

instead of

áßå®

i new wchar_t. how expected output?

i believe, need change code

 wprintf(l"%s",wstr); 

to

wprintf(l"%ls",wstr); 

ref: c11 standard, chapter §7.29.2.1, emphasis mine

l (ell)
specifies following d, i, o, u, x, or x conversion specifier applies long int or unsigned long int argument; following n conversion specifier applies pointer long int argument; following c conversion specifier applies wint_t argument; that following s conversion specifier applies pointer wchar_t argument; or has no effect on following a, a, e, e, f, f, g, or g conversion specifier.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -