Questions tagged [console-input]

Console-input is related to inputting data through the console, or command-line, instead of a GUI.

Console is currently the most basic application interface, commonly used for small applications, for which GUI is unnecessary. Often an output from another application can be redirected to a console input of another application - see Pipeline.

38 questions
13
votes
7 answers

Read numbers from the console given in a single line, separated by a space

I have a task to read n given numbers in a single line, separated by a space ( ) from the console. I know how to do it when I read every number on a separate line (Console.ReadLine()) but I need help with how to do it when the numbers are on the…
tabula
  • 253
  • 1
  • 3
  • 13
10
votes
3 answers

Idiomatic way to write Clojure code for repeatedly reading lines from the console?

Recently I was writing a little CLI script which needed to repeatedly read dates from the console (the number of dates to read was calculated and could be different each time). Sample Ruby code to give you the idea: dates = x.times.collect { print…
Alex D
  • 28,136
  • 5
  • 72
  • 115
5
votes
3 answers

What is the End Of File/Stream keyboard combination to use with System.in.read()

Apologize if this trivial question has already been answered, I cannot find it at SO. Reading lines from the IDE console with this Java trivial code (Windows 7 and Eclipse Kepler): int v; try { while ((v = System.in.read()) != -1)…
mins
  • 4,503
  • 9
  • 45
  • 62
3
votes
2 answers

High Order and Low-order byte

The prototypes for getchar() and putchar() are: int getchar(void); int putchar(int c); As ,its prototype shows, the getchar() function is declared as returning an integer.However, you can assign this value to a char variable, as is usually…
rimalroshan
  • 729
  • 1
  • 9
  • 25
3
votes
1 answer

Haskell Foreign Function Interface with GHCI in Windows

First of all, I specify that I use Windows 10 64bit and Haskell Platform 8.0.1. I try to use FFI of Haskell in Windows using following code. import Control.Monad import Data.Char import Foreign.C getCh :: IO Char getCh = liftM (chr . fromEnum)…
3
votes
0 answers

Hide console input with Eclipse PyDev

I am quite new to Python and started using Eclipse with Pydev recently. I am writing a script where I'd like to enter a password via the console, and the password should not be displayed. So far I was calling getpass.getpass(), which was fine when…
P. Camilleri
  • 10,591
  • 6
  • 33
  • 58
3
votes
1 answer

A interesting practice about getchar() function

When I do practice on K&R,I found a very interesting question: code as follows: include main() { …
kursk.ye
  • 317
  • 3
  • 11
2
votes
1 answer

Console I/O : printf & scanf not occurring in expected order

#include #include #include void eat() // clears stdin upto and including \n OR EOF { int eat;while ((eat = getchar()) != '\n' && eat != EOF); } int main(){ printf("\n COMMAND : "); char cmd[21]="";…
user13863346
  • 307
  • 9
2
votes
2 answers

In Go, is it possible to write to the console and read back?

I'm writing a wizard for a CLI in Go. What I'd like to do is ask the user what he wants to do, prepare the appropriate CLI command, and write it to the console. The user then would submit the command to the CLI by pressing Enter, possibly after…
David Tootill
  • 449
  • 5
  • 10
1
vote
1 answer

How to make the console accept input from the Enter key only?

I'd like to make the C# console only accept input from the Enter key on the startup screen. I've made it so that it closes the console when anything but the Enter key is pressed. How can I make it so that the console only accepts input from the…
1
vote
0 answers

JavaScript console input/output output trouble

Code output should be: 515 30 However, when I add variables a, b, c my output is 51530. I've added a + b just to test it, and the output was 515. I just can't figure out how to return the c so that it won't combine with the 515. function Init_sta()…
Hannah
  • 5
  • 1
  • 4
1
vote
3 answers

Read An already Entered Line From The Console C++

I know this is an odd question, but is there any way of reading a previous input from the console? Something like: The fox is brown // line 1 The duck is yellow // line 2 Here where the control is right now_ // but I want to read line 2 P.S : I'm…
1
vote
2 answers

Run Java Console Input as Statement

I am writing a command-line matrix manipulation tool in Java, and was wondering if it is possible to run Java statements through console input. I was thinking of using the java.util.Scanner object since that's what I'm using for the rest of my…
1
vote
2 answers

What happens when I use javaw to run the java program in the following scenario?

Say suppose I am running a java program through command line. And this program requires some data to enter during the execution. So I was wondering on what happens if somebody uses javaw to run this type of program? That is how to enter the data to…
GuruKulki
  • 24,340
  • 43
  • 131
  • 192
1
vote
1 answer

Leiningen freezing on console input

Why does trying to read a line from console with a BufferedReader freeze Leiningen REPL? lein repl nREPL server started on port 65142 REPL-y 0.2.0 Clojure 1.5.1 Docs: (doc function-name-here) (find-doc "part-of-name-here") Source:…
missingfaktor
  • 86,952
  • 56
  • 271
  • 360
1
2 3