console-application

Convert keycode to char/string

折月煮酒 提交于 2019-12-01 21:07:13
I'm trying to convert System.Windows.Forms.Keys to string/char using : KeysConverter converter = new KeysConverter(); string text = converter.ConvertToString(keyCode); Console.WriteLine(text); But it returned "OemPeriod" for "." and "Oemcomma" for ",". Is there any way to get the exact character? Prime_Aqasix This is probably what you really want (bit late, but hope this will help someone else), converting the keycode directly to the character the key prints. First add this directive into your class: [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern int ToUnicode( uint

Need help with accepting decimals as input in C#

感情迁移 提交于 2019-12-01 21:04:47
I have written a program in C# that runs the Pythagorean Theorem. I would love some help on allowing the program to accept decimal points from the user input. This is what I have. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Project_2 { class Program { static void Main(string[] args) { int sideA = 0; int sideB = 0; double sideC = 0; Console.Write("Enter a integer for Side A "); sideA = Convert.ToInt16(Console.ReadLine()); Console.Write("Enter a integer for Side B "); sideB = Convert.ToInt16(Console.ReadLine()); sideC = Math.Pow((sideA * sideA

RestSharp response unauthorized

≡放荡痞女 提交于 2019-12-01 20:55:48
I am new to web based solutions. I am hitting a rest url using RestSharp library. My code is as follows: var cleint = new RestClient("http://REST_URL"); cleint.Authenticator = new HttpBasicAuthenticator("username", "password"); var request = new RestRequest(); request.Method = Method.GET; request.Resource = "0.json"; IRestResponse response = cleint.Execute(request); if (response != null && ((response.StatusCode == HttpStatusCode.OK) && (response.ResponseStatus == ResponseStatus.Completed))) { // var arr = JsonConvert.DeserializeObject<JArray> (response.Content); } The url returns a json file,

Console Application with task scheduler

吃可爱长大的小学妹 提交于 2019-12-01 20:42:46
问题 I have created a console and I want to run it every 1-minute nonstop I try to put in a scheduler task but I think that my configuration is done badly can someone help, please? I want to finish this task thank 回答1: You can follow the tutorial here How to Create a Automated Task that Runs at a Set Time in Windows 7 The steps outlined are as follows: Open up Task Scheduler by either typing "task" into the Start Menu search bar, or by opening All Programs -> Accesories > System Tools . Select '

C# Getting strange results for a simple math operations

最后都变了- 提交于 2019-12-01 20:33:55
I have noticed for some strange behavior while adding two doubles, sometimes it works correct, and sometimes not! Here is the first example: double num1 = 0.1 + 0.7; //Guess the result? Easy - 0.8 !!! or not? Look at the strange result: And guess what, the if statement is going inside the else block, and prints the num1 - and no, it doesn't prints 0.799999999999993, it prints 0.8. So I have gone one more step forward and tried this code: if (0.1 + 0.7 == 0.8) //Returns false ?? { Console.WriteLine("Correct"); } OK, strange, but now I found the correct way, it should use f (float). As I

Performance difference of iostream console output between Windows and OSX?

∥☆過路亽.° 提交于 2019-12-01 20:26:25
问题 given the following very simple for loop: int main (void) { for (int i = 0 ; i < 1000000; i++) { std::cout<<i<<std::endl; } } running this code on a clean Windows 8 professional using Microsoft visual studio 2012 takes about 15 secs for every 100k prints. On mac os x , using the same computer , it takes barely 3 secs for xcode to output 1 mill lines. I'm almost 100% sure that it has nothing with the performance and it is just something that is related to the output mechanics or something. Can

Compile Console App as 32 bit

风格不统一 提交于 2019-12-01 20:09:28
I have a Windows Console Application that I need to compile as 32 bit. It's written in C# and I have all the Visual Studio 2012 updates. I've tried following several things on here, but I'm never given an option for 32 bit. How can I compile it as 32 bit? With Visual Studio you are able to target what platform. By default it will run on "Any CPU" (read 32 or 64 bit), but you can specify if you desire. Look under Project>Properties>Build and look for the "Platform Target" property. The target platforms are called "X64" and "X86", where "X86" is 32bit. 来源: https://stackoverflow.com/questions

how can I write an ANSI C console screen buffer?

僤鯓⒐⒋嵵緔 提交于 2019-12-01 19:56:52
I'm working on making an ASCII based game, and everywhere I look people are saying to use Console.Write() from MSDN, which is dandy and all if you're using Windows, but I'm not. And thus, I'm trying to write a function, or group of functions in C that can alternate between two screen buffers, and write them to the screen, similar to what man pages would be like, as well as pico, vim, and emacs. I have the buffer's working, and found an old ASCII game for linux called 0verkill that uses C and putchar() to place each character on the screen, but all of my attempts to re-create that, result in a

C# library for more ConsoleColors? [duplicate]

大憨熊 提交于 2019-12-01 19:52:12
This question already has an answer here: redefining Console colour palette in c# 1 answer Custom text color in C# console application? 10 answers I have been writing console apps for a while and noticed that the consoles (such as cmd.exe) support RGB colors but the 'Console' class for .NET doesn't. Does anyone know of a library that would allow RGB colors for a console app in C#? user2038443 I have found a solution but it is not worth the time and effort, this should be easier to do and i hope that in future versions of .NET framework this process will be simplified. 来源: https://stackoverflow

Console Application with task scheduler

做~自己de王妃 提交于 2019-12-01 19:21:06
I have created a console and I want to run it every 1-minute nonstop I try to put in a scheduler task but I think that my configuration is done badly can someone help, please? I want to finish this task thank You can follow the tutorial here How to Create a Automated Task that Runs at a Set Time in Windows 7 The steps outlined are as follows: Open up Task Scheduler by either typing "task" into the Start Menu search bar, or by opening All Programs -> Accesories > System Tools . Select ' Create Basic Task ' from the right hand pane and the ' Create Basic Task ' Wizard will open. With the Wizard