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.

46 questions
12
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
  • 243
  • 1
  • 4
  • 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
  • 29,755
  • 7
  • 80
  • 126
7
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…
rooni
  • 1,036
  • 3
  • 17
  • 33
4
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
  • 6,478
  • 12
  • 56
  • 75
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
  • 12,664
  • 7
  • 41
  • 76
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
  • 389
  • 1
  • 3
  • 12
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
  • 327
  • 2
  • 11
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
  • 541
  • 5
  • 11
1
vote
1 answer

How do use console to choose any file from a folder?

I need to be able to choose any file inside a folder by input on console. Code Instead of a predefined like "bridge_rgb.png" I want to be able to choose any file in the folder via console input. private void imageName() { …
Dylan
  • 23
  • 4
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
1 answer

Getting console input with win32 api in x86 assembly

In my assembly program I called AllocConsole from the kernel32 library, however I do not know how to get input from the allocated console. Is there any function that the winapi contains that will get input from the allocated console in the current…
mike bayko
  • 375
  • 5
  • 20
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
2 3 4