The standard output stream (stdout) is the stream where a program writes its output data.
Questions tagged [stdout]
4740 questions
31
votes
5 answers
remove last STDOUT line in Python
I am trying to figure out how to suppress the display of user input on stdout.
raw_input() followed by any print statement preserves what the user typed in. getpass() does not show what the user typed, but it does preserve the "Password:" prompt.
To…

javanix
- 1,270
- 3
- 24
- 40
30
votes
4 answers
Saving stdout from subprocess.Popen to file, plus writing more stuff to the file
I'm writing a python script that uses subprocess.Popen to execute two programs (from compiled C code) which each produce stdout. The script gets that output and saves it to a file. Because the output is sometimes large enough to overwhelm…

jasper77
- 1,553
- 5
- 19
- 31
30
votes
6 answers
Get output from a Paramiko SSH exec_command continuously
I am executing a long-running python script via ssh on a remote machine using paramiko. Works like a charm, no problems so far.
Unfortunately, the stdout (respectively the stderr) are only displayed after the script has finished! However, due to the…

Lukas N.P. Egger
- 923
- 2
- 9
- 12
30
votes
3 answers
Rewinding std::cout to go back to the beginning of a line
I'm writing a command-line tool for Mac OS X that processes a bunch of files. I would like to show the user the current file being processed, but do not want a bazillion files polluting the terminal window.
Instead I would like to use a single line…

fbrereto
- 35,429
- 19
- 126
- 178
30
votes
4 answers
How can I run an external command and capture its output in Perl?
I'm new to Perl and want to know of a way to run an external command (call it prg) in the following scenarios:
Run prg, get its stdout only.
Run prg, get its stderr only.
Run prg, get its stdout and stderr, separately.

gameover
- 11,813
- 16
- 59
- 70
30
votes
1 answer
How to silence statsmodels.fit() in python
When I want to fit some model in python,
I often use fit() method in statsmodels.
And some cases I write a script for automating fitting:
import statsmodels.formula.api as smf
import pandas as pd
df = pd.read_csv('mydata.csv') # contains column x…

keisuke
- 2,123
- 4
- 20
- 31
30
votes
2 answers
What is the simplest way to write to stdout in binary mode?
I've been trying to figure out the best way to write binary data to stdout from a C program. It works fine on Linux, but I'm having issues when I compile on Windows because "\n" gets converted to "\r\n".
Is there a standard way to write to stdout in…

jncraton
- 9,022
- 3
- 34
- 49
30
votes
1 answer
Using files as stdin and stdout for subprocess
How do I replicate the following batch command using python subprocess module?
myprogram < myinput.in > myoutput.out
In other words, how do I run myprogram using the contents of myinput.in as the standard input and myoutput.out as standard output?

Nolander
- 301
- 1
- 3
- 3
30
votes
4 answers
Redirect both cout and stdout to a string in C++ for Unit Testing
I'm working on getting some legacy code under unit tests and sometimes the only way to sense an existing program behavior is from the console output.
I see lots of examples online for how to redirect stdout to another file in C++, but is there a way…

thelsdj
- 9,034
- 10
- 45
- 58
30
votes
1 answer
Opening a TStream on stdin/stdout in a Delphi console app
I'm trying to write a Delphi console application that creates a TStream for its standard input, and another TStream for its standard output.
(It will be launched by a host app with its input and output redirected to pipes, and will be passing binary…

Joe White
- 94,807
- 60
- 220
- 330
29
votes
7 answers
Getting realtime output from ffmpeg to be used in progress bar (PyQt4, stdout)
I've looked at a number of questions but still can't quite figure this out. I'm using PyQt, and am hoping to run ffmpeg -i file.mp4 file.avi and get the output as it streams so I can create a progress bar.
I've looked at these questions:
Can ffmpeg…

Jason O'Neil
- 5,908
- 2
- 27
- 26
29
votes
1 answer
How could I temporary redirect stdout to a file in a C program?
Within my C program, I’d like to temporarly redirect stdout to /dev/null (for example). Then,
after writing to /dev/null, I’d like to restore stdout. How do I manage this?

Frank
- 18,432
- 9
- 30
- 30
29
votes
4 answers
What is the "sys.stdout.write()" equivalent in Ruby?
As seen in Python, what is the sys.stdout.write() equivalent in Ruby?

matt jack
- 821
- 2
- 8
- 9
29
votes
1 answer
stdout vs console.write in c#
I am VERY new to C#/programming and as a learning exercise completed an online challenge to change text to lowercase. The challenge specified it must 'print to stdout' yet I completed the challenge by using Console.Writeline
using System;
using…

Prendoza
- 317
- 1
- 3
- 7
29
votes
9 answers
printf slows down my program
I have a small C program to calculate hashes (for hash tables). The code looks quite clean I hope, but there's something unrelated to it that's bugging me.
I can easily generate about one million hashes in about 0.2-0.3 seconds (benchmarked with…

Flavius
- 13,566
- 13
- 80
- 126