C/C++ printing UK pound symbol from wint_t

I am on a Linux system and set the keyboard setting to UK in order to capture and print out a UK pound symbol (£).

Here is my code:

#include <stdio.h>
#include <wchar.h>
#include <locale.h>

int main ()
{
wint_t wc;
fputws (L"Enter text:\n", stdout);

setlocale(LC_ALL, "");
do
{
wc=getwchar();
wprintf(L"wc = %lc %d 0x%x\n", wc, wc, wc);
} while (wc != -1);

return 0;
}

Here is the output:

$ ./test
Enter text:
£
wc = GBP 163 0xa3

I want to print out the actual UK pound symbol (£) instead of GBP...how can I do that?
Last edited on
Topic archived. No new replies allowed.