What’s a good Java, curses-like, library for terminal applications? [closed]
Lanterna I found the Lanterna library recently. Haven’t had the opportunity to use it yet but it looks like a more up-to-date alternative to the others.
Lanterna I found the Lanterna library recently. Haven’t had the opportunity to use it yet but it looks like a more up-to-date alternative to the others.
the issue here is that their Hello World Program is showing up then it would immediately close. why is that? Because it’s finished. When console applications have completed executing and return from their main method, the associated console window automatically closes. This is expected behavior. If you want to keep it open for debugging purposes, … Read more
It’s likely that your output encoding is set to ASCII. Try using this before sending output: Console.OutputEncoding = System.Text.Encoding.UTF8; (MSDN link to supporting documentation.) And here’s a little console test app you may find handy: C# using System; using System.Text; public static class ConsoleOutputTest { public static void Main() { Console.OutputEncoding = System.Text.Encoding.UTF8; for (var … Read more
Note: This answer shows how to switch the character encoding in the Windows console to UTF-8 (code page 65001), so that shells such as cmd.exe and PowerShell properly encode and decode characters (text) when communicating with external (console) programs with full Unicode support, and in cmd.exe also for file I/O.[1] If, by contrast, your concern … Read more
[UPDATE] For latest Windows 10 please read useful contribution by @brainslugs83, just below in the comments to this answer. While for versions before Windows 10 Anniversary Update: ANSI.SYS has a restriction that it can run only in the context of the MS-DOS sub-system under Windows 95-Vista. Microsoft KB101875 explains how to enable ANSI.SYS in a … Read more
System.Reflection.Assembly.GetExecutingAssembly().Location1 Combine that with System.IO.Path.GetDirectoryName if all you want is the directory. 1As per Mr.Mindor’s comment: System.Reflection.Assembly.GetExecutingAssembly().Location returns where the executing assembly is currently located, which may or may not be where the assembly is located when not executing. In the case of shadow copying assemblies, you will get a path in a temp directory. … Read more
As you discovered, in VS11 the compiler will disallow an async Main method. This was allowed (but never recommended) in VS2010 with the Async CTP. I have recent blog posts about async/await and asynchronous console programs in particular. Here’s some background info from the intro post: If “await” sees that the awaitable has not completed, … Read more
Console.ReadLine will block execution until the user has pressed the enter key. It then returns the full string of whatever the user typed on that line. You can then write conditional code which acts on whatever that returns. So, for instance: Dim input As String = Console.ReadLine() If input = “Hello World” Then Console.WriteLine(“Hello to … Read more
It is because you exceed the number of lines that your console is set to display at once. The property is called Console.BufferHeight. Try writing Console.WriteLine(Console.BufferHeight); to see the number of lines your console is set to display at once. You can change it simply by writing setting it to your desired value, e.g. Console.BufferHeight … Read more
change while ((action != 1) || (action != 2) || (action != 3) || (action != 4)); // (1) to while ((action != 1) && (action != 2) && (action != 3) && (action != 4)); // (2) Analysis: if action == 1 (1) will evaluate to while(false || true || true || true) => … Read more