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
0 answers

I have tried the following script in R using readline() to get input from the console but the program doesn't stop to take the input:

I am trying to take 4 different inputs from the console in R, but the console takes the input only if I run the program line by line separately. If I send all the commands together there is no possibility to input the information: I tried with the…
0
votes
1 answer

Read .txt each line stream and REPLACE string values separated by [,] comma

I am fairly new to C# Here I want to get the contents of List.txt and replace the GUID and Password from the list. The objective here is to replace the GUID and PASSWORD from each each line from the file List.txt List Format: …
Ryan Smith
  • 17
  • 6
0
votes
1 answer

C# Console closing despite Console.ReadLine() call and more code

The following code is causing the console to close (exit code 0, telling me that the program is finished). Weird thing is: it doesn't even go to the switch (choice) statement. The debugger shows me that the Console.ReadLine() statement is reached,…
Guntram
  • 414
  • 2
  • 5
  • 18
0
votes
1 answer

Does Console.Read() takes the first digit as input when a two/more digit number as entered?

I am new to C#. So, I was practicing by writing some simple codes. I decided to write a code where the user will enter a number and the same number will be shown as the output. I wrote the following code and it worked perfectly. However,when I…
Rajdeep Dutta
  • 876
  • 1
  • 8
  • 16
0
votes
4 answers

In C# I am taking a char input and then I output something. But after input control is not waiting for enter and straightaway giving output

I have the following code: using System; namespace MyApp { class KeyBoardInputTest { static void Main() { Console.Write("Enter a character >\t"); char ch = (char)Console.Read(); Console.WriteLine(""); …
puregeek
  • 175
  • 3
  • 9
0
votes
1 answer

How can I put a string character before Console.ReadLine() Console application

I want to put a character before the user input, like in the regular cmd. I tried Console.WriteLine("]", input = Console.ReadLine()) where input is the string that gets the user input, but it does not work. I also tried something on the lines of…
Terpomo
  • 9
  • 1
  • 2
0
votes
0 answers

Using Scanner class in conjunction with System.console().readLine()?

I would like to know if using the Scanner class in conjuction with the System.console.readLine() method results in faster input read. To give you an example, I have created the following program using both of the above, only the Scanner class and…
0
votes
1 answer

Unable to copy file. Access to path denied

I just did a fresh download of Visual Studio 2015 on my laptop running Win10 (x64). I go to create my first Console Application and is opens successfully. I proceed to write a simple application.. namespace ConsoleApplication1 { class Program …
0
votes
2 answers

How to run a C# program without needing Console.ReadLine()?

After I run a program, I always need to add Console.ReadLine(); to the end in order for the program results to not go away. If I were to code: static void Main(string[] args) { Console.WriteLine("Hello World!"); Console.ReadLine(); // I need…
States
  • 43
  • 7
0
votes
4 answers

What do I use to convert string into unicode

I am having an issue with this block of code. Console.WriteLine("What is your name?"); string PlayerName = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(PlayerName); What I'm trying to do is get the computer to read…
0
votes
2 answers

c#, printing items in list returns empty when list.add(Console.ReadLine)

The console doesn't write the items in the list. I am trying to add input from user to a list then write to the screen. So once i add input to the list i would want it to print to the screen. ArrayList list = new ArrayList(); switch (userInput) …
eyedfox
  • 714
  • 1
  • 7
  • 14
0
votes
5 answers

C# ReadLine float

I try convert string to float because I using Console.ReadLine() for input. The Console.ReadLine() only accept string values, but I need convert. How I can do that? Thank you.
Mesuko
  • 23
  • 1
  • 1
  • 6
0
votes
1 answer

Why is Console.ReadLine() ignoring spaces?

I am trying to test a simple console app which takes an input and checks if it has unique chars in it or not. On providing an input of " a", it just takes in the string as "a" and ignores the preceding spaces. Can you please help me understand why…
Ankit
  • 115
  • 10
0
votes
1 answer

Reading user input from powershell through scriptcs

Here I have a problem to read user inputs from Command prompt or windows powershell through scriptcs.I tried with Console.ReadLine(),Console.Read() or Console.ReadKey() wrapped it around Convert.ToString() to get user response but none of them gives…
boney
  • 11
  • 5
0
votes
1 answer

How to read from console into String variable in C#

String Firstname, Lastname; Char Gender = 'm'; Console.WriteLine("Cis247a, Week 2 Lab"); Console.WriteLine("Name: Kyle Landell"); Console.WriteLine("This program accepts user input as a string, then makes the" + Environment.NewLine + "appropriate…
L. Lawrence
  • 1
  • 1
  • 1