Questions tagged [console.readline]

Reads the next line of characters from the standard input stream.

Console.ReadLine reads input from the console. When the user presses enter, it returns a string. We then resume the program and process the string to determine the next action to take.

114 questions
0
votes
1 answer

how to close console window automatically after console.readline() in C#

I have a console application which does some process and shows some success and failure messages at the end with Console.Readline(); Once the user see those messages, lets say in 10 seconds I want to close the console window automatically but that…
msbyuva
  • 3,467
  • 13
  • 63
  • 87
0
votes
4 answers

Converting decimal to binary with user input

I wanna make a c# application that convert a decimal number into binary with the input from the user. I get a red squiggly line on bin, when declaring bin = Convert.ToString(decToBin,2);. I don't understand my problem, so any help would be…
TNJ
  • 3
  • 3
0
votes
3 answers

How to change Cursor position in Console?

I wanted to use Console.ReadLine(); in the previous line and make it display like that: HeresomeText>(input) Not like HeresomeText> (input) Is it possible to do?
Mg112
  • 27
  • 2
  • 9
0
votes
2 answers

Why does my code not run when I type in "Set Code"?

I have this code here: string code1 = null; Console.Write("Username: " + Environment.UserName.ToString() + ">"); if (Console.ReadLine() == "info") { Console.WriteLine("Info:"); } else if (Console.ReadLine() == "Set…
0
votes
4 answers

need help asking the user for inputs for the second time in C#

since im new to C#, even though i have coded in C before, i still have a question on how I go about to execute the part where i ask the user to enter a set of inputs after a program has already been run. The following program prints a calendar with…
Abner_CV
  • 25
  • 1
  • 2
  • 10
0
votes
1 answer

Console.Readline Issue

After providing the first input I have to press enter twice. What am I doing wrong in my code: public static void Ifcondition() { string answer,value1; Console.Clear(); Console.WriteLine("Would you like to enter your Name"); …
Ashish
  • 19
  • 3
0
votes
1 answer

Is there a way to keep Console.ReadLine in memory for later referral in C#?

I want to write an if statement that would essentially say, "If what was entered into the last Console.ReadLine() method contained an "!""...do something. So, I've got a method: static void Operations(StringBuilder bleh, int ops, int count, string…
flimflam57
  • 1,334
  • 4
  • 16
  • 31
0
votes
1 answer

int whichAccount = int.Parse(Console.ReadLine()); not working second loop

this is my first post, apologies for mistakes I may make and bad formatting. The issue I am having is that the second time it loops int whichAccount = int.Parse(Console.ReadLine()); does not work and won't take my input. It raises the exception…
user2281248
  • 13
  • 3
  • 8
0
votes
2 answers

linux pass text into readline of a given process

I've got a process that reads console input from user (readline, raw_input, etc. - depending on platform). There is another process that wants to feed the first process with a given input. How to do this in linux? Is it possible? PS the language I'm…
ducin
  • 25,621
  • 41
  • 157
  • 256
-1
votes
1 answer

Console readline fractional number

Why with double number = double.Parse(Console.ReadLine()); Console.WriteLine($"{number:0.00}"); or double number = double.Parse(Console.ReadLine()); Console.WriteLine("{0:0.00}", number); the console doesn't write the fractional number i have…
-1
votes
1 answer

Simple Console.ReadLine not working in ASP.NET Core project

I have an ASP.NET Core project and I need to ask an input to the developer with a Console.ReadLine() at the project launch but it's not working. When the Console.ReadLine() is hit, it sends me to the local webpage that the project makes appear when…
-1
votes
1 answer

Console.ReadLine fails to change input with .ToUpper

I'm creating a Choose your own adventure game and I'm trying to get the user input to change to uppercase using .ToUpper(); but for whatever reason if the input isn't already caps it skips the else if statement and goes to the next step in the game.…
Jason Siegel
  • 23
  • 1
  • 1
  • 3
-1
votes
2 answers

Error CS0029 Cannot implicitly convert type 'string' to 'double'

I am creating an C# calculator console using visual studio and code and when I am typing and debugging my application I got this error "Error CS0029 Cannot implicitly convert type 'string' to 'double'". I think my code was not compatible. Can…
CeRie
  • 1
  • 2
-1
votes
1 answer

exporting seiral masseges to text file using pyserial

I'm new to python and I've write a simple code that reading lines from serial port and than write those lines to a text file. No errores occured, but the serial masseges did not appear in the text. the code: import serial ser =…
-1
votes
1 answer

Console WriteLine while waiting for console ReadLine

I have a console app that is running multiple worker threads. I would like the console output to have one WriteLine to report the status of each thread. I know I can simply clear, and loop through my threads to report their status on some interval,…
Roger
  • 2,063
  • 4
  • 32
  • 65