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;
}
Also, I wanted to store the UK pound symbol (£) as part of a string. I've found that std::string does NOT indicate an accurate size when wide characters are stored...is wstring much better to use in this case? Does it provide a more accurate size?