console-application

How to get size of data available thru stdin with C++ [duplicate]

僤鯓⒐⒋嵵緔 提交于 2019-12-12 03:36:09
问题 This question already has answers here : WinAPI C++ client detect write on anonymous pipe before reading (3 answers) Closed 6 years ago . If I get a handle to stdin from a console app like so: HANDLE hStdIn = ::GetStdHandle(STD_INPUT_HANDLE); I can then read data from it: BYTE buff[32]; DWORD dwcbRead = 0; BOOL bReadRes = ::ReadFile(hStdIn, buff, SIZEOF(buff), &dwcbRead, NULL); My question is, how do I know how many bytes are available before I read them? PS. ReadFile seems to block if there

Insert float value into SQL Server table

时光毁灭记忆、已成空白 提交于 2019-12-12 02:53:21
问题 I have a float value that I'm trying to insert into a SQL Server table with this code: SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = new SqlCommand("AddNewValue", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("value", SqlDbType.Float).Value = value; try { connection.Open(); command.ExecuteNonQuery(); } finally { if (connection.State == ConnectionState.Open) { connection.Close(); } } And this is the stored

C# I can't get CreateNoWindow to work - not even the msdn.com example

亡梦爱人 提交于 2019-12-12 02:26:07
问题 I have looked here https://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.createnowindow(v=vs.110).aspx And I understand that A) Not every program respects it CreateNoWindow request and B) It requires UseShellExecute=False (default is true). C) It is meant to indicate whether a window is created. (it won't ever hide the parent window). It's speaking of whether a window is created for the child process. (msdn says 'new window') D) CreateNoWindow defaults to false. I am

thread println and read so that println has priority

半世苍凉 提交于 2019-12-12 02:16:56
问题 Adapting Apache WeatherTelnet code, I'm working towards a MUD client, but am struggling with concurrent input/output. It's not possible to read and write simultaneously, of course. For this application, out should have priority over in . If nothing is being written to java.lang.System.out then, and only then, should input from java.lang.System.in be read. I'm just not sure how to accomplish that because in and out are interwoven. run and memory dump: thufir@dur:~$ thufir@dur:~$ thufir@dur:~$

Making a simple calculator with arrays in C#

混江龙づ霸主 提交于 2019-12-12 02:16:33
问题 I am trying to make a simple calculator with arrays in C#. Firstly I tried making it using two integers and one operator only and it worked well. Now I am trying to do so that the user can make the expression as long as they like. For example 7 * 7 + 1 / 50 instead of a simple 9 + 8 which includes only one operator and two integers. The problem is that whenever I type a long expression with multiple numbers and operators it only calculates the first 2 numbers with the first operator. What is

Azure webjobs failed [Access is denied]

被刻印的时光 ゝ 提交于 2019-12-12 01:44:07
问题 I created a console application to read gmail inbox.I need my console app to read emails every 15 minutes.So i published the console app as webjobs with runmode : "On demand" and published the app using azure services (web apps). But my webjobs doesn't seem to run and there is no option to schedule a webjob when i select publish as azure webjobs. As soon as i publish i get this error in visual studio : 'ICICIEmailParser.sstageEntities-Web.config Connection String' argument cannot be null or

How to convert an input string to uppercase in c#

泄露秘密 提交于 2019-12-12 00:15:42
问题 string choice = String.ToUpper(Console.ReadLine()); I want to input a string and convert it to upper case. However, there's an error that states : cannot convert from 'string' to System.Globalization.CultureInfo' that appears when I hover over the Console.ReadLine() . Why doesn't this work , and what fixes are there? And is there another way to do this ? 回答1: String.ToUpper is an instance method, that means you have to use it "on" your string: string input = Console.ReadLine(); string choice

Console app scheduled task run two different ways

*爱你&永不变心* 提交于 2019-12-11 23:28:39
问题 I have a program for a client that needs to run one set of code every 30 minutes via a scheduled task. at 1:30 am it needs to run a separate set of code. Both sets of code will generate a file and place it in a directory. How do I set it up to be able to run two sets of SQL code? I could do it getting the current date time and comparing it but that seems bulky to me. Is there a way a schedule task can run a program which would pass in something to my Main(string[] args)? Is there a correct

trapping a key before it gets to the Console

*爱你&永不变心* 提交于 2019-12-11 19:56:56
问题 THE SETTING: A Console program, in .net I am using readkey in a loop, which rewrites to the same line on the screen (Console.setCursorPosition) however, if I type Enter, the Console pushes the text upwards, which is the usual command line behaviour. THE QUESTION: Is it possible to trap a key press (that Enter), so that my program will get the key, but the Console does not? The environment is Linux, with Mono (and the program is supposed to be cross platform). so low level windows driver

write files to a location from another user and domain

≡放荡痞女 提交于 2019-12-11 18:06:44
问题 I m working on a console application that tries to download some files from a website by logging in and then copying the files to a shared folder. Here the domain I am working in is different that the domain of that shared folder where I need to save the files. Currently I overcome this problem manually by opening the shared folder from the run and putting the username and password into the windows authentication dialog and then running the application. Here is the code I m using - static