Questions tagged [stdout]

The standard output stream (stdout) is the stream where a program writes its output data.

4740 questions
39
votes
4 answers

Read stdin stream in a batch file

Is it possible to use a piped stdin stream inside a batch file? I want to be able to redirect the output of one command into my batch file process.bat list so: C:\>someOtherProgram.exe | process.bat My first attempt looked like: echo…
m0tive
  • 2,796
  • 1
  • 22
  • 36
39
votes
8 answers

How can I redirect stdout to some visible display in a Windows Application?

I have access to a third party library that does "good stuff." It issues status and progress messages to stdout. In a Console application I can see these messages just fine. In a Windows application they just go to the bit bucket. Is there a…
JoeBieg
  • 411
  • 1
  • 4
  • 7
39
votes
2 answers

How to save model.summary() to file in Keras?

There is model.summary() method in Keras. It prints table to stdout. Is it possible to save this to file?
Dims
  • 47,675
  • 117
  • 331
  • 600
39
votes
4 answers

How to remove last character put to std::cout?

Is it possible on Windows without using WinAPI?
Xirdus
  • 2,997
  • 6
  • 28
  • 36
39
votes
5 answers

How can I capture the stdout from a process that is ALREADY running

I have a running cron job that will be going for a while and I'd like to view its stdout. I don't know how important the fact that the process was started by cron is, but I figure I'd mention it. This is on OSX so, I don't have access to things…
theraccoonbear
  • 4,283
  • 3
  • 33
  • 41
39
votes
11 answers

How to write buffer content to stdout?

Is there any chance to write the content of the current vim buffer to stdout? I'd like to use vim to edit content that was passed via stdin - without the need of a temporary file to retrieve the modified content (on Linux/Unix). Is it possible that…
hooblei
  • 3,210
  • 2
  • 20
  • 17
39
votes
3 answers

Should I output warnings to STDERR or STDOUT?

I'm making a script that handles a predefined set of data, outputting to a file. I want to pop up a warning when one datum (which is always "Regular" in every set that I've had access to) is different stating that this value is unhandled (since I…
Stuart P. Bentley
  • 10,195
  • 10
  • 55
  • 84
37
votes
2 answers

How to Pipe Output to a File When Running as a Systemd Service?

I'm having trouble piping the STDOUT & STDERR to a file when running a program as a systemd service. I've tried adding the following to the .service file: ExecStart=/apppath/appname > /filepath/filename 2>&1 But this doesn't work. The output is…
MichaelB76
  • 640
  • 1
  • 6
  • 15
37
votes
3 answers

Why does stdout need explicit flushing when redirected to file?

The behaviour of printf() seems to depend on the location of stdout. If stdout is sent to the console, then printf() is line-buffered and is flushed after a newline is printed. If stdout is redirected to a file, the buffer is not flushed unless…
Patrick
  • 1,283
  • 2
  • 13
  • 20
36
votes
5 answers

In Java, how can I redirect System.out to null then back to stdout again?

I've tried to temporarily redirect System.out to /dev/null using the following code but it doesn't work. System.out.println("this should go to stdout"); PrintStream original = System.out; System.setOut(new PrintStream(new…
dgrant
  • 1,417
  • 3
  • 16
  • 23
36
votes
3 answers

stdout progress bars don't work in Pycharm

Many programs display progress bars by printing to stdout and then returning to beginning of line and printing again. This way they can achieve realtime progress bar appearence. Unfortunately, in many cases this functionality does not work in…
Dims
  • 47,675
  • 117
  • 331
  • 600
36
votes
4 answers

bash: redirect (and append) stdout and stderr to file and terminal and get proper exit status

To redirect (and append) stdout and stderr to a file, while also displaying it on the terminal, I do this: command 2>&1 | tee -a file.txt However, is there another way to do this such that I get an accurate value for the exit status? That is, if I…
rouble
  • 16,364
  • 16
  • 107
  • 102
35
votes
5 answers

Python 2.x - Write binary output to stdout?

Is there any way to write binary output to sys.stdout in Python 2.x? In Python 3.x, you can just use sys.stdout.buffer (or detach stdout, etc...), but I haven't been able to find any solutions for Python 2.5/2.6. EDIT: I'm trying to push a PDF file…
Eavesdown
  • 353
  • 1
  • 3
  • 6
35
votes
6 answers

Error: write EPIPE when piping node output to "| head"

I'm having problems with getting the error: events.js:48 throw arguments[1]; // Unhandled 'error' event ^ Error: write EPIPE at errnoException (net.js:670:11) at Object.afterWrite [as oncomplete]…
Fluffy
  • 27,504
  • 41
  • 151
  • 234
34
votes
4 answers

Standard input and output units in Fortran 90?

How can I read and write to the standard input, output and error streams stdin, stdout and stderr in Fortran? I've heard writing to stderr, for example, used to be write(5, fmt=...), with 5 the unit for stderr, and I know the way to write to stdout…
AncientSwordRage
  • 7,086
  • 19
  • 90
  • 173