How can I cin and cout some unicode text?

I had a similar problem in the past, in my case imbue and sync_with_stdio did the trick. Try this: #include <iostream> #include <locale> #include <string> using namespace std; int main() { ios_base::sync_with_stdio(false); wcin.imbue(locale(“en_US.UTF-8”)); wcout.imbue(locale(“en_US.UTF-8″)); wstring s; wstring t(L” la Polynésie française”); wcin >> s; wcout << s << t << endl; return 0; }

Is there a way to create a second console to output to in .NET when writing a console application?

Well, you could start a new cmd.exe process and use stdio and stdout to send and recieve data. ProcessStartInfo psi = new ProcessStartInfo(“cmd.exe”) { RedirectStandardError = true, RedirectStandardInput = true, RedirectStandardOutput = true, UseShellExecute = false }; Process p = Process.Start(psi); StreamWriter sw = p.StandardInput; StreamReader sr = p.StandardOutput; sw.WriteLine(“Hello world!”); sr.Close(); More info on … Read more

Does Console.WriteLine block?

Does Console.WriteLine block until the output has been written or does it return immediately? Yes. If it does block is there a method of writing asynchronous output to the Console? The solution to writing to the console without blocking is surprisingly trivial if you are using .NET 4.0. The idea is to queue up the … Read more

Clear console screen in Java [duplicate]

As dirty hacks go, I like msparer’s solution. An even dirtier method that I’ve seen used (I would never do this myself. I swear. Really.) is to write a bunch of newlines to the console. This doesn’t clear the screen at all, but creates the illusion of a clear screen to the user. char c=”\n”; … Read more

How to clear the console using Java?

Since there are several answers here showing non-working code for Windows, here is a clarification: Runtime.getRuntime().exec(“cls”); This command does not work, for two reasons: There is no executable named cls.exe or cls.com in a standard Windows installation that could be invoked via Runtime.exec, as the well-known command cls is builtin to Windows’ command line interpreter. … Read more