console-application

C/C++: is it possible to pass binary data through the console? [duplicate]

*爱你&永不变心* 提交于 2019-12-05 21:25:06
This question already has answers here : What is the simplest way to write to stdout in binary mode? (2 answers) Closed 4 years ago . I would like to know if it is possible that an utility yields binary data (i.e. graphical images) and outputs them through IO console, while another application, instructed about the nature of those data and informed of the number of the incoming bytes, is able to read it from IO console. Yes, it is possible. While it's true that often stdin / stdout are meant to be text there are many programs that are designed to get binary input or write binary output from

How to get returned value of async Task<string> method name()?

纵饮孤独 提交于 2019-12-05 19:51:33
问题 I'm trying to get the return string of my method but the problem is I don't know how can I get the return value from public async Task<string> Login(string username, string password, string site) . This is my codes from Program.cs static void Main(string[] args) { var username = "Leonel.Sarmiento"; var password = "welcome"; var site = "QADBSite"; var url = "na1.sabacloud.com"; ConsoleCustomizer.Spinner Spinner = new ConsoleCustomizer.Spinner("+", "x", "+", "x"); ConsoleCustomizer.TypeWriter

Synchronizing events from different threads in console application

青春壹個敷衍的年華 提交于 2019-12-05 15:22:07
I am feeling like a total noob asking this, but anyway, here it goes: I was wondering what the easiest way of synchronizing events from different threads is. Some sample code: class Program { static void Main(string[] args) { Console.WriteLine("# started on:" + Thread.CurrentThread.ManagedThreadId); tt t = new tt(); t.First += new EventHandler(t_First); t.Second += new EventHandler(t_Second); Task task = new Task(new Action(t.Test)); task.Start(); while (true) { Console.ReadKey(); Console.WriteLine("# waiting on:" + Thread.CurrentThread.ManagedThreadId); } } static void t_Second(object sender,

using curses with raw_input in python

假装没事ソ 提交于 2019-12-05 14:39:41
In my python linux console application I use curses to handle displaying of data. At the same time I'd like to have an input line to enter commands, pretty much in good ol' irssi-style. With default curses getch() I'd have to do a lot of coding just to get the basic funcionality of raw_input function - arrow keys to move cursor / browse through the input history. Is there a simple way to get such behavior working with curses, as it captures input events and I can't just use functions that read sys.stdin. Use curses.textpad http://www.python.org/doc/2.4.1/lib/module-curses.textpad.html 来源:

Correct Way to Exit From Console Application [duplicate]

℡╲_俬逩灬. 提交于 2019-12-05 14:39:12
This question already has an answer here: What is the command to exit a Console application in C#? 6 answers I've done some reading here , and here and I'm still confused about if I should use Enviorment.Exit() in my console application. In a method, I have the following code if the user types exit at the prompt, if(userSelect == "exit"){ { Environment.Exit(0); } Update: class Program { public static void Main(string[] args) { Console.WriteLine("Welcome to my Console App"); Console.WriteLine(); consoleManager(); } public static void consoleManager() { string consolePrompt="ConsoleApp">";

In a Dart console application, is there a library for an HTTP Request that doesnt require DOM access?

[亡魂溺海] 提交于 2019-12-05 13:01:08
I started off by trying to use HTTPRequest in dart:html but quickly realised that this is not possible in a console application. I have done some Google searching but can't find what I am after (only finding HTTP Server), is there a method of sending a normal HTTP request via a console application? Or would I have to go the method of using the sockets and implement my own HTTP request? There's an HttpClient class in the IO library for making HTTP requests: import 'dart:io'; void main() { HttpClient client = new HttpClient(); client.getUrl(Uri.parse("http://www.dartlang.org/")) .then(

SetConsoleScreenBufferInfoEx … bug?

霸气de小男生 提交于 2019-12-05 12:41:59
Each time I run this code ( on Win7) the console gets 1 character smaller in both directions. int wmain( INT argc, WCHAR **argv ) { CONSOLE_SCREEN_BUFFER_INFOEX csbi; csbi.cbSize = sizeof(CONSOLE_SCREEN_BUFFER_INFOEX); GetConsoleScreenBufferInfoEx(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); wprintf(L"Window: %u x %u\n", csbi.srWindow.Right - csbi.srWindow.Left + 1, csbi.srWindow.Bottom - csbi.srWindow.Top + 1); SetConsoleScreenBufferInfoEx(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); return 0; } I doubt that's expected behavior. Is it documented? Is it any better in newer versions of Windows? Here's

Scala: Draw table to console

删除回忆录丶 提交于 2019-12-05 12:27:38
问题 I need to display a table in a console. My simple solution, if you would call it a "solution", is as follows: override def toString() = { var res = "\n" var counter = 1; res += stateDb._1 + "\n" res += " +----------------------------+\n" res += " + State Table +\n" res += " +----------------------------+\n" for (entry <- stateDb._2) { res += " | " + counter + "\t | " + entry._1 + " | " + entry._2 + " |\n" counter += 1; } res += " +----------------------------+\n" res += "\n" res } We don't

How do I write a c++ console exe which I can run on msdos?

ぃ、小莉子 提交于 2019-12-05 12:15:26
I've been looking all over google for this but never got a clear answer.. I'm trying to write a simple hello world application and make it run under msdos (which I will be installing on a old rig lying around here). But first things first, I've been trying to compile a normal console application and drop it in dosbox to test it out which doesn't work, just says it's invalid. So I assume I need something else to compile it with. Does this mean I'm obligated to build my code in a msdos environment? Even if this is the case, I have no clue at all how to do this, kinda a msdos dummy.. If anyone

How to add font color to a .net console app?

孤人 提交于 2019-12-05 11:49:01
问题 Is there a way to color the font of certain lines in a console app in .net? Thanks 回答1: http://msdn.microsoft.com/en-us/library/system.console.foregroundcolor.aspx You can change the foreground and background colors of the console. The foreground color is of course the text. 回答2: Console.BackgroundColor = ConsoleColor.Blue; Console.ForegroundColor = ConsoleColor.Yellow; 来源: https://stackoverflow.com/questions/5299790/how-to-add-font-color-to-a-net-console-app