console-application

WCF Named Pipes timeout in a WinApp, but not in a ConsoleApp?

情到浓时终转凉″ 提交于 2020-01-17 08:33:29
问题 In relation to Async two-way communication with Windows Named Pipes (.Net) which seems dead (the thread that is) :/ I'm wondering why the following code works perfectly in a ConsoleApplications, but when I do exactly the same thing with WindowsApplications I get an timeout on the client when calling "Console.WriteLine(proxy.ProcessData());". The strange thing is that the server method "ProcessData" is called without any exceptions, but still I get a timeout after the default 1 min?! How can I

How to make sure only 1 thread has access to DataTable at a time

我只是一个虾纸丫 提交于 2020-01-17 04:05:52
问题 I have this Windows Console Application: using System; using System.Text; namespace ThreadLockSample { class Program { static void P1(System.Data.DataTable dt) { for (int i = 0; i < 100000; i++) { dt.Rows.Add(i); } } static void P2(System.Data.DataTable dt) { for (int i = 100000; i < 200000; i++) { dt.Rows.Add(i); } } static void Main(string[] args) { System.Data.DataTable dt = new System.Data.DataTable(); for (int i = 0; i < 200; i++) dt.Columns.Add("Id " + i); System.Threading.Thread t1 =

Having troubles trying to read and display a text file to the console in c#

余生长醉 提交于 2020-01-16 12:02:45
问题 I am trying to make a trivia game in c# using a console application. And I am having troubles getting the console to read the file. Currently what its doing is saying that the file could not be read and the the index was outside the bounds of the array. But then everything that is in the text file gets displayed. I am unsure on what I get the file could not be read but then the file gets displayed. The file is a .txt file and here is what is looks like What is another name for SuperMan?,the

Setting Console to Maximized in Dev C++ [duplicate]

六眼飞鱼酱① 提交于 2020-01-16 05:06:25
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Changing the width of a Windows console window? Im writing a simple brick breaker program. How do I maximize the console window, when the program starts. #include <iostream> #include <windows.h> #include <algorithm> #include <conio.h> #define _WIN32_WINNT 0x500 using namespace std; int lives = 2; void gotoxy(int x , int y); void hideCursor(); class Grid { public: char grid[20][79]; void fill() { for(int i = 0; i

Getting stdout contents without disabling cout/cin

眉间皱痕 提交于 2020-01-15 12:33:09
问题 Is it possible to save terminal (previously) written contents (stdout), to an array of strings: vector<string> lines; without disabling cin/cout normal functionality, in a linux console application. In a terminal window in addition to characters there's coloring information for each character. Is there a way to save them in another array? 回答1: If you mean you want to write inside a program to std::cout and have the data appear both on the terminal and in some program-internal data structure,

.net console app stop responding when printing out lots of chars in a row

这一生的挚爱 提交于 2020-01-15 06:00:12
问题 I am trying to figure out why a program I am working on goes in to "not responding" mode when I ask it to output a large amount of characters to the console it is running in. I tried creating a small example that just prints out characters, and this will indeed also go "not responding" on me after some 10-20 seconds: static void Main(string[] args) { for (int i = 0; i < 255; i = (i+1) % 255) { Console.Write(((char)i)); } } The program is still running though, even though the console window is

How to call classes from one Project in another Project?

孤者浪人 提交于 2020-01-14 14:20:31
问题 Excuse the incredibly silly question but im new to C# . I just can’t figure out how to use classes from one Project in another Project. Lets say I want to take a string from Project1 to Project2 and have Project2 print said string . I reference Project2 from Project1 with the “add reference” menu , then I add “using Project2” and then I write this to trying and call "print" from "ClassA" in "Project2". Project2.ClassA Classa = new Project2.ClassA(); Console.WriteLine(Classa.print); but all i

Displaying images in a console application?

十年热恋 提交于 2020-01-13 20:21:12
问题 I have a console application which screen scrapes some data, and now I need to do image comparisons. If the images are different, I want to show the images to the user. What's the best way to display two images during the execution of a console application? I'm assuming I would use some sort of inter-process communication to send information back and forth, but I'm not sure how exactly I would go about doing that in a good fashion. Also, I'd rather NOT store the images to files if possible.

Is it possible to attach a non-console Win32 application to the invoking cmd shell?

浪子不回头ぞ 提交于 2020-01-13 09:36:15
问题 When I have a Win32 non-console application (AFAIK, the console-ness of a Win32 app is linked into the exe), starting it from the console cmd.exe will return to the command prompt immediately, running the application "in the background" (o.c. it can have a GUI of sorts, or even open its own console window) Is it possible in the non-console executable to detect that it was launched from cmd.exe and "attach" it to the launching cmd.exe? And note that there are various questions/answers related

How to disable Open file – Security warning

安稳与你 提交于 2020-01-13 09:22:11
问题 I have a weird question. I have written a winform server application and a winform client application. The role of the client is to send commands for running a certain script to the server. The server receives those commands, parses them, and runs them. These two work great. I have written a cmd application which uses some of the functions from my client. This application is supposed to function as a cmd client. The question is this: When I run the winform client, the server runs the commands