code:
#include <windows.h>
int main() {
SetConsoleOutputCP(CP_UTF8);
system("echo Ιλιάδα");
}
prints on console: Ιλιάδα
Source is encoded in UTF-8 with BOM.
But if I try: system(L"echo Ιλιάδα");, I get error: error: cannot convert 'const wchar_t*' to 'const char*' for argument '1' to 'int system(const char*)'. And of course I didn’t expect anything else here. Is there any other function that will accept these characters ?
Use
_wsystemone for wide strings.