Questions tagged [stdin]
Standard input (stdin, file descriptor 0) is the input stream to a program.
stdin
3,917
questions
2
votes
1
answer
101
views
How can I read one byte from stdin in Dyalog APL?
I’m trying to make a terminal user interface in Dyalog APL and need a way to read a single byte of user input from stdin. How can I do this? In Python for example, you can use sys.stdin.read(1).
I’ve ...
-1
votes
2
answers
103
views
C fgets string length not limited to input
I'm confused how even though the char array mystring I provided can only be upto 5 characters long, the length can exceed 5 if fgets is supplied with a larger limit.
#include <stdio.h>
#include &...
1
vote
1
answer
67
views
Can I access FFPlay.exe's STDIN in order to emulate a 'q' keypress?
I am writing a Win32 program that launches ffplay.exe. I would like to have my program send a quit message ('q') but cannot get ffplay to respond. I am using CreatePipe() to initialize read/write ...
0
votes
1
answer
54
views
How do I post a character to a console program's STDIN?
I am writing a Win32 program in C that launches a console application which can be stopped by pressing Q on the keyboard. Pressing Q on the keyboard makes the console application stop; I just want to ...
1
vote
2
answers
61
views
Can a non-interactive tclsh be made interactive?
When developing Tcl code, I find the interactive facilities of tclsh very useful, and I'll often launch tclsh interactively, source code from files, and continue to run and debug from there.
What I'm ...
1
vote
0
answers
60
views
Redirect sys.stdin and sys.stdout [duplicate]
I'm trying to redirect stdin and stdout. My first attempt I tried this code:
from sys import stdin, stdout
stdin = open('in.txt','r')
stdout = open('out.txt','w')
for line in stdin:
print(line)
...
2
votes
0
answers
105
views
Is there a way to git grep stdin?
I want to use git grep with input taken from stdin. There is an option --no-index but according to documentation it only allows to grep files in the current directory:
--no-index
Search files in the ...
0
votes
1
answer
148
views
How to get Pipe and Here String in Python?
When calling a Python script via
echo foobar | python myscript.py <<< test123
How can I get both strings (the "foobar" and "test123") in the Python script?
When trying
...
1
vote
2
answers
273
views
Cannot turn off line buffering in C
So, I'm working on a big project, and it requires the stdin and stdout buffers to be disabled so that input and output are processed immediately. However, when I try to do that using setbuf or setvbuf,...
1
vote
1
answer
59
views
Why grep ignores the first line of "python3 -m http.server" output?
For some reason grep will not print the first line of the output of the command:
python3 -m http.server
python3 -m http.server
# prints: Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
...
-1
votes
1
answer
97
views
One-way communication in python
For the last day I've been trying to get some one-way continuous communication between two python scripts as an exercise for a bigger project. However, subprocess.communicate only allows a one-time ...
1
vote
1
answer
182
views
How to check if input is empty?
How to check if user inputs nothing and presses enter only? If that happens then error message and code stops. In C language.
I tried == '\n' and " " but nothing works :(
int main() {
...
0
votes
1
answer
38
views
Python Popen Subprocess - interacting with executable not possible until stdin is closed
I am trying to interact with a Commandline Executable, but I am stucked.
I would like to print out every line, the .exe is producing to stdout.
Until I get "condition" in a line -> then ...
0
votes
1
answer
199
views
How to connect the stdin streams of parent and child processes?
I have problem to write stdin in deno version 1.37.0 (release, x86_64-pc-windows-msvc). I search in documentation, google, try the code and not work. I found related code in https://github.com/...
-3
votes
1
answer
78
views
this code prints nothing on intelliJ idea, it didn't even takes user input or anything
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
// Write your code here.
...