I
Ioannis Vranos
[The current message encoding is set to Unicode (UTF-8) because it
contains Greek]
The following code does not work as expected:
#include <wchar.h>
#include <locale.h>
#include <stdio.h>
#include <stddef.h>
int main()
{
char *p= setlocale( LC_ALL, "Greek" );
wchar_t input[50];
if (!p)
printf("NULL returned!\n");
fgetws(input, 50, stdin);
wprintf(L"%s\n", input);
return 0;
}
Under Linux:
[john@localhost src]$ ./foobar-cpp
Test
T
[john@localhost src]$
[john@localhost src]$ ./foobar-cpp
Δοκιμαστικό
�
[john@localhost src]$
Under MS Visual C++ 2008 Express:
Test
Test
Press any key to continue . . .
Δοκιμαστικό
??????ε????
Press any key to continue . . .
Am I missing something?
contains Greek]
The following code does not work as expected:
#include <wchar.h>
#include <locale.h>
#include <stdio.h>
#include <stddef.h>
int main()
{
char *p= setlocale( LC_ALL, "Greek" );
wchar_t input[50];
if (!p)
printf("NULL returned!\n");
fgetws(input, 50, stdin);
wprintf(L"%s\n", input);
return 0;
}
Under Linux:
[john@localhost src]$ ./foobar-cpp
Test
T
[john@localhost src]$
[john@localhost src]$ ./foobar-cpp
Δοκιμαστικό
�
[john@localhost src]$
Under MS Visual C++ 2008 Express:
Test
Test
Press any key to continue . . .
Δοκιμαστικό
??????ε????
Press any key to continue . . .
Am I missing something?