console-application

How to Draw Box,Rectangle in a C# Console application

拜拜、爱过 提交于 2019-12-21 20:47:52
问题 I ask for 2 related questions. 1-How we can Put outputs(such as Results and Messages) inside a box in a c# console application. 2-How we can draw rectangle in a c# console application.thank u for any sample tutorial or advice 回答1: Assuming you just meant a character box this will do it. private static void DrawABox( int x, int y, int width, int height,char Edge,string Message ) { int LastIndex =0 ; Console.SetCursorPosition(x, y); for ( int h_i = 0; h_i <= height ; h_i++ ) { if ( LastIndex !=

Dos based printing using C#.net

扶醉桌前 提交于 2019-12-21 20:24:15
问题 i m using Dotmatrix printer EPSON for printing the reports, and i need the of how to print the reports without using crystalReport and print dialog, i.e. i want the code for DOS based printing in C#.net......... 回答1: I know a very old and dirty way. Just open LPT1 (or the printer port you are using) as a stream and output the characters. 回答2: Maybe this will help? http://support.microsoft.com/kb/322091/EN-US 回答3: Does your printer appear in windows? In other words, can your print to it from

Batch Script to Automate a DOS Program with Options

拈花ヽ惹草 提交于 2019-12-21 19:39:59
问题 I have a console program ( a DOS program) that requires interactive input. After typing in the command line, for example commandline.exe /ShowReport The DOS prompt will prompt user to key in some values, and then proceed to the next interactive input. For example, when I typed in the above command, the console will prompt me with the following options: press '1' to show Report A press '2' to Show Report B And I would press '1' if I want to show report A. The issue now is I want to automate

WebClient error when downloading file from https URL

三世轮回 提交于 2019-12-21 17:47:42
问题 Trying to download xml file from https URL (https://nvd.nist.gov/download/nvd-rss.xml) This URL is openly accessible through browser. Using C# Webclient with console project. But getting Exception as below using (WebClient client = new WebClient()) { System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3; client.DownloadFile(uri, @"c:\test\nvd-rss.xml"); } $exception {"The underlying connection was closed: An unexpected error occurred on a send."} System.Net

How to call REST API from a console application?

此生再无相见时 提交于 2019-12-21 17:45:31
问题 How to call REST API from a console application? The response from my REST service will be XML format. In web I am calling like this string url = string.Format("{0}/name?PrimaryName={1}", ConfigurationManager.AppSettings["URLREST"], txtName.Text); string details= CallRestMethod(url); public string CallRestMethod(string url) { HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(url); webrequest.Method = "GET"; webrequest.ContentType = "application/x-www-form-urlencoded"; webrequest

Cross platform, Interactive text-based interface with command completion

﹥>﹥吖頭↗ 提交于 2019-12-21 16:47:32
问题 Does anyone know of a C++ library that will provide a text-based interactive interface? I want to create two versions of an application; a console based program that will perform whatever actions are given on the command line or interactively at the console as well as a GUI based program (Mac Cocoa and Windows MFC). Both versions will share a common C++ backend. For the console based program I would like similar history abilities to readline (which I cannot use as this application will be

Running a C# console application as a Windows service

不打扰是莪最后的温柔 提交于 2019-12-21 11:29:10
问题 I have a basic C# console application that I would like to run as a Windows Service. I have created the Windows service using sc create . This worked fine, and I can see my service under services.msc . When I try and start this service I get the following error: Could not start the PROJECT service on Local Computer. Error 1053: The service did not respond to the start or control request in a timely fashion.` I read that this might be due to the service code taking longer than 30000 ms to

cout<< “привет”; or wcout<< L“привет”;

断了今生、忘了曾经 提交于 2019-12-21 07:39:27
问题 Why cout<< "привет"; works well while wcout<< L"привет"; does not? (in Qt Creator for linux) 回答1: GCC and Clang defaults to treat the source file as UTF-8. Your Linux terminal is most probably configured to UTF-8 as well. So with cout<< "привет" there is a UTF-8 string which is printed in a UTF-8 terminal, all is well. wcout<< L"привет" depends on a proper Locale configuration in order to convert the wide characters into the terminal's character encoding. The Locale needs to be initialized in

cout<< “привет”; or wcout<< L“привет”;

无人久伴 提交于 2019-12-21 07:39:12
问题 Why cout<< "привет"; works well while wcout<< L"привет"; does not? (in Qt Creator for linux) 回答1: GCC and Clang defaults to treat the source file as UTF-8. Your Linux terminal is most probably configured to UTF-8 as well. So with cout<< "привет" there is a UTF-8 string which is printed in a UTF-8 terminal, all is well. wcout<< L"привет" depends on a proper Locale configuration in order to convert the wide characters into the terminal's character encoding. The Locale needs to be initialized in

How to add App.Config file in Console Application

孤人 提交于 2019-12-21 06:46:25
问题 I want to store the connection string and some parameters in app.config file which we generaly do for windows aplication but I can't find app.config file for console application. So how should I use this file, how to add this file or there is some other work arroud for the same functionality. I am working in console application 回答1: Right click on application->Go to Add->you will see the exact picture What i have attached here->Pick the Application Config File. 回答2: Well, the other answers