#include "crt.bi"
'#include "crt/locale.bi"
'setlocale(LC_ALL, "")
dim as wstring*10 ws = "AAA"
wprintf(@wstr(!"%C") , 1079) ' Not Work!!!!!!!!!!!!!
wprintf(@wstr(!"%c") , 1079) ' Not Work!!!!!!!!!!!!!
wprintf(@wstr("hello")) ' Not Work!!!!!!!!!!!!!
wprintf(@ws) ' Not Work!!!!!!!!!!!!!
dim as long i = getwchar
putwchar(1079) ' output "7" instead "з"
' ? i ' can not use getwchar + fb print , otherwise there will be garbage in the terminal https://www.freebasic.net/forum/viewtopic.php?t=31621
I thought I read that printf() and wprintf() can't be mixed on the same stream. Like either the stdout is configured for chars or wchars. But I'm not 100% sure about that. If that's true though, it would be related to fb runtime taking control of the terminal's input and output streams right from the start when a program is first run.
coderJeff wrote:
I thought I read that printf() and wprintf() can't be mixed on the same stream.
It seems so. I don't know the source code of the compiler, perhaps creating a choice between (printf or wprintf) for users - is not an easy task. But in any case, if FB by default disables some CRT functions without the possibility of using them, this is a bad option. Thank you for your interest in this topic!