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
10
votes
5 answers

Node.js readline: Unexpected token =>

I am learning node.js and need to use readline for a project. I have the following code directly from the readline module example. const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output:…
user3700129
  • 139
  • 1
  • 1
  • 7
8
votes
5 answers

How do I ask the user for input in C#

I am switching from Python to C# and I am having trouble with the ReadLine() function. If I want to ask a user for input Python I did it like this: x = int(input("Type any number: ")) In C# this becomes: int x = Int32.Parse (Console.ReadLine());…
user7316312
8
votes
3 answers

Node.js readline in debug-console in Visual Studio Code

I'm new to Visual Studio Code, Javascript and Node.js. Coming from C# I want to debug something like this with breakpoints set in Debugging-console: var name = Console.readline(); Console.Writeline(name); It seems to be so simple, but I fail. What…
piccus
  • 161
  • 2
  • 9
7
votes
4 answers

How to read "Enter" from the keyboard to exit program

I have written a simple program in C# in Visual Studio 2013. At the end of my program I instruct the user to: "Please Press Enter to Exit the Program." I would like to get the input from the keyboard on the next line and if ENTER is pressed, the…
6
votes
3 answers

C# Console.ReadLine after ReadKey waits for input two times

I don't understand what I am missing here, but it seems that Console.ReadKey() is still active and is causing the Console to make me enter twice when using Console.ReadLine() after invoking Console.ReadKey(). I've searched up and down how to escape…
Autonomic
  • 150
  • 4
  • 15
5
votes
2 answers

Difference between Console.ReadLine and Console.In.ReadLine

I came across these two APIs to read input from user in a simple console application in C#: System.Console.ReadLine() System.Console.In.ReadLine() Here is a small code snippet where I'm trying to leverage these two: namespace StackOverflow { …
RBT
  • 24,161
  • 21
  • 159
  • 240
5
votes
4 answers

How to insert a value in a different position via ReadLine in C#?

I would like to ask the user for his/her weight; for example; Console.Write("Please enter your weight: {I want it to be inserted here} kg"); Here the input will be inserted after the kg, although I want it to be just before "kg" so that the user…
Mohamed
  • 71
  • 2
5
votes
1 answer

Is it possible to use Console.ReadLine() more than once?

Is there any way that I can make this program display both text by using Console.ReadLine(); twice? I provided my code below and whenever I debug I only get the ones provided above the first one, but when I remove the first Console.ReadLine();…
amped247
  • 93
  • 7
4
votes
1 answer

F# Reading input from console

I have a little problem with my code that i wrote it's for reading input from console in F# as sequence of lines. My problem is that it read only 5 lines of text and then end but it should read more lines. Would be nice if someone told me what is…
Rafal
  • 81
  • 9
4
votes
2 answers

What's the best way to read from stdin?

I am currently trying to learn F# better and I am using codingame as an source of programming quizzes. Most of the quizess involves reading some values from stdin, like the first ten values on stdin will be ints, the next five will be…
Christian Sauer
  • 10,351
  • 10
  • 53
  • 85
4
votes
2 answers

console.readline display something before

I have something like this: Console.WriteLine("Y ="); Y = Convert.ToInt32(Console.ReadLine()); and it displays like this Y= //and here i have to input my value I want to put my value on the same row Y= //here to input my value Any tips?
3
votes
3 answers

Is it possible to write a message inside a "Console.ReadLine()"

Is there a way to write a message inside of Console.ReadLine() Like: Console.ReadLine("What is your name: ");
d51
  • 316
  • 1
  • 6
  • 23
3
votes
2 answers

RabbitMQ BasicConsume and Event Driven Issues relating to Console.ReadLine()

The program below is basically the program from Receiver/Worker program from the C# Rabbit MQ Tutorial here: https://www.rabbitmq.com/tutorials/tutorial-two-dotnet.html (with a counter added). There are two or three things that have me stumped…
NealWalters
  • 17,197
  • 42
  • 141
  • 251
3
votes
1 answer

C# Console - How to ReadLine() without a new line? ( or undo a \n or a vertical \b)

I want to know if it is possible to get back to the last line when I'm at the beginning of the next line? (in C# Console, of course) I mean Console.WriteLine() cause going to the next line and I want to stay in my line even after pressing enter.…
Ali
  • 43
  • 1
  • 5
3
votes
3 answers

Why does the ReadLine () method NOT pause for user input?

I began to study C#, but I ran into a problem. The ReadLine() method does not pause for user input. I just started C#, and it works on other people's programs, so I have no idea why. I am using Xamarin on a Mac. Here is an example code that does not…
user3477016
  • 145
  • 1
  • 8
1
2 3 4 5 6 7 8