Questions tagged [stdin]

Standard input (stdin, file descriptor 0) is the input stream to a program.

3861 questions
1
vote
2 answers

How to stop scanf with less arguments

I need to keep getting 3 values ​​(int, int, float) from the keyboard and only stop the loop when I enter 0. The problem is that when I enter 0 and press [Enter it keeps waiting for the second and third value. int i, j; float v; while…
1
vote
2 answers

How do I automate Google App Engine upload_data with --passin and subprocess.Popen?

Here is what I have: process = subprocess.Popen(["cmd.exe", "/c" "appcfg.py", "upload_data", "--config_file=..\\bulkloader.yaml", …
1
vote
1 answer

how to copy&paste cleanly into grep?

I have some test output, looking like PASS: tests/test_mutex_rmw PASS: tests/test_mutex_trylock PASS: tests/test_malloc_irreg FAIL: tests/ARMCI_PutS_latency FAIL: tests/ARMCI_AccS_latency PASS: tests/test_groups PASS: tests/test_group_split PASS:…
Rizzer
  • 404
  • 4
  • 11
1
vote
1 answer

R check if `stdin()` is empty

I believe this question has been asked for almost all languages except for R. Essentially I'd like to check if stdin() is empty but I do not know how to do it. This is because if you perform the following bit of code your session will hang (probably…
Justin Landis
  • 1,981
  • 7
  • 9
1
vote
1 answer

Delay occurred when reading bytes from stdin (Using pipe)

I am writing a C program that take sox's output as input for my program. Generally, my program would read the input from stdin and make some processing afterward. However, when I read byte values from stdin and wrote it back to another file (just…
JonnyJack
  • 109
  • 8
1
vote
1 answer

how do i redirect fifo to stdin using python either with subprocess or with pwntools?

As an example I am trying to "imitate" the behaviour of the following sets of commands is bash: mkfifo named_pipe /challenge/embryoio_level103 < named_pipe & cat > named_pipe In Python I have tried the following commands: import os import…
1
vote
2 answers

Replacing characters with other characters in C files

I am attempting to write a program that takes in two files (or if not provided either file, uses stdin/stdout to replace a specified character array with another character array. For example: if passed "--ax -+td" then my program will replace every…
croblin
  • 61
  • 4
1
vote
2 answers

Using stdin and stdout if no file is given in C

I have a program that copies a source file to a destination file. In the event that only 1 or neither of these files are provided by the user, I'd like to use stdin or stdout. For example: The source file name is not provided in command line…
Kapernski
  • 709
  • 4
  • 7
1
vote
4 answers

How do I read in the Enter key as an input in C?

How do I read in the Enter key as an input in C? I'd like some program like this: "Please enter a key to go to next line" How do I add this type of option in C? I am new to programming.
1
vote
1 answer

Why will Bash's read builtin not take input from the yes command via a pipe, but will work with process substitution?

TL;DR I'd like to understand why the yes command works properly with most tools and scripts that read from standard input, but fails to work with Bash's own read builtin except when using process substitution or a complex set of shell options. I…
Todd A. Jacobs
  • 81,402
  • 15
  • 141
  • 199
1
vote
1 answer

Run a second script, passing STDIN

Clickbank (and others) post an IPN message to the URL address on the domain / server. Presumably, the data goes to , and the script processes. I'm on Windows / Strawberry Perl, and can emulate this by posting form data to the script. The…
Cristofayre
  • 121
  • 1
  • 11
1
vote
1 answer

Golang segment stdin stream to file

instead of writing a pipe to a huge file i want to segment the stream in chunks on signal USR1. i think i got the basics working but the app just hangs and nothing happens, any clues or best practices when handling with an uncontrollable input…
JRSmile
  • 25
  • 4
1
vote
2 answers

How to completely clear stdin and the \n before scanf()

Environment: Windows 7 Enterprise SP1 gcc version 6.3.0 (MinGW.org GCC-6.3.0-1) I'm new to C language (not new to programming). I'm migrating a big program to C language. All works fine except for this. I create this small program to reproduce the…
Maurizio
  • 41
  • 1
  • 3
1
vote
0 answers

How to split multiline stdin input in r?

I am working in R and am supposed to split the stdin inputs using space and newline characters. However, when I take the input as a string from stdin using the following code: f <- file("stdin") open(f) sampleInput <- readLines(f) with the…
Naman Bansal
  • 191
  • 2
  • 13
1
vote
1 answer

Palindromic Prime numbers array creator [Speed Issues] RUBY

I want to create an array of palindromic prime numbers nth numbers. I wrote the code below: # Enter your code here. Read input from STDIN. Print output to STDOUT require 'prime' number = gets power_array = -> (array_size) do …
naarter
  • 21
  • 5