stdin Questions

4

Solved

I have a program that basically reads a text file and counts the number of occurrences of each word on each line. Everything works properly when reading from a text file using an ifstream, however,...
Notorious asked 14/4, 2014 at 0:45

3

Solved

I am using Visual Studio Code to debug my Python code. I want to redirect one text file in stdin and the output be written in another file. I can reach that by running python directly using the f...
Northwesterly asked 26/11, 2019 at 22:21

7

Solved

I'm streaming data using netcat and piping the output to gawk. Here is an example byte sequence that gawk will receive: =AAAA;=BBBB;;CCCC==DDDD; The data includes nearly any arbitrary characters, ...
Turkic asked 3/7, 2024 at 3:57

5

Solved

I'm trying to write the results of a function to stdin. This is the code : def testy(): return 'Testy !' import sys sys.stdin.write(testy()) And the error I get is : Traceback (most recent c...
Decani asked 24/2, 2013 at 19:16

3

Solved

Here's the description of gets() from Prata's C Primer Plus: It gets a string from your system's standard input device, normally your keyboard. Because a string has no predetermined length, get...
Silicle asked 24/9, 2015 at 8:51

6

I have read about 5-10 different advices how to clear stdin, but none of them suits my needs. The thing is that fflush(stdin) worked perfectly at my computer, but unfortunately it doesn't seem to w...
Metaplasm asked 19/4, 2016 at 9:58

12

Solved

I'm looking to process a text file with node using a command line call like: node app.js < input.txt Each line of the file needs to be processed individually, but once processed the input line...
Memnon asked 20/11, 2013 at 3:39

9

I am attempting to accept input from the console in Kotlin but it is difficult because I am not too sure about the syntax. I begin with the main fun main(args: Array<String>) { } WHAT ...
Lafontaine asked 22/12, 2016 at 12:39

7

Solved

I'm trying to write a Python script that starts a subprocess, and writes to the subprocess stdin. I'd also like to be able to determine an action to be taken if the subprocess crashes. The process...
Eusebiaeusebio asked 12/12, 2011 at 13:46

2

Solved

I try to debug some code in vs code. Everything works fine, but when I trying input something in console nothing happens. my code: #include <stdio.h> #define SIZE 20 int main() { char arr[...
Valet asked 11/11, 2020 at 12:9

8

Solved

Is there a way to effectively do this in bash: /my/bash/script < echo 'This string will be sent to stdin.' I'm aware that I could pipe the output from the echo such as this: echo 'This strin...
Riccio asked 30/6, 2011 at 21:7

9

Solved

How can you make SSH read the password from stdin, which it doesn't do by default?
Shanteshantee asked 27/8, 2009 at 11:7

2

Solved

I'm using Git Bash on Windows 10. I would like to import a SQL file to be run in my PostGres 12 local database. I tried the below $ PGPASSWORD=$DB_PASSWORD psql -U${DB_USER} $DB_NAME < scripts/m...
Harrier asked 20/7, 2022 at 14:19

4

Solved

I want my application to be able to read the input from a redirected file stream through source > my_app, but I do not want it to ask for user input in case there is no redirection. C provides ...
Hypogenous asked 31/3, 2020 at 14:26

6

Solved

I want to read a single character at-a-time from the command line in PHP, however it seems as though there is some kind of input buffering from somewhere preventing this. Consider this code: #!/u...
Advertising asked 10/9, 2010 at 11:53

2

I know this question has been asked several times but it seems ineffective in my case. [[ ! -t 0 ]] = Does standard input contains anything? This command: echo 'Hello world' | [[ ! -t 0 ]] echo $? ...
Phaeton asked 3/12, 2023 at 16:36

6

Solved

What is the required syntax to redirect standard input/output on Windows PowerShell? On Unix, we use: $./program <input.txt >output.txt How do I execute the same task in PowerShell?
Duwalt asked 12/7, 2012 at 8:10

2

I'm trying to use an external process which reads the STDIN, and writes to STDOUT. I want to write the equivalent of this in Elixir, without using an external library or wrapper script: $ echo foo ...
Luciferase asked 17/12, 2022 at 10:40

5

Solved

I need to do something like this post, but I need to create a subprocess that can be given input and give output many times. The accepted answer of that post has good code... from subprocess impor...
Annunciate asked 19/2, 2015 at 20:13

5

Solved

I basically want to test if stdin has input (like if you echo and pipe it). I have found solutions that work, but they are ugly, and I like my solutions to be clean. On linux I use this: bool Std...
Hemihydrate asked 27/7, 2011 at 4:42

3

in the BusyBox command for Linux exists the command microcom to communicate with a serial modem: BusyBox v1.13.2 (2012-05-10 17:13:08 CEST) multi-call binary Usage: microcom [-d DELAY] [-t TIMEOU...
Waddell asked 28/8, 2012 at 14:17

3

Solved

I want to do something like: for line in sys.stdin: do_something() if is **END OF StdIn**: do_something_special() After a few tries, for now I am doing this: while True: try: line = sys.stdin...
Warfourd asked 6/6, 2014 at 19:14

5

Solved

I am writing my first clojure program, and want to read lines from stdin. When I try this: (doall (map #(println %) (line-seq *in*))) I get this exception: Exception in thread "main" java.lang...
Stopped asked 9/1, 2010 at 16:47

20

Solved

I have the following program: int main(int argc, char *argv[]) { char ch1, ch2; printf("Input the first character:"); // Line 1 scanf("%c", &ch1); printf("Input the...
Lissotrichous asked 26/10, 2011 at 2:48

4

Solved

stdin is of type FILE *, is there a fd macro for it? Or do I need to convert it myself?
Fragile asked 5/7, 2011 at 13:30

© 2022 - 2025 — McMap. All rights reserved.