stdout

Is stdout line buffered, unbuffered or indeterminate by default?

我是研究僧i 提交于 2019-12-27 09:08:12
问题 Section 7.9.13/7 of c99 states that: At program start-up, three text streams are predefined and need not be opened explicitly - standard input (for reading conventional input), standard output (for writing conventional output), and standard error (for writing diagnostic output). As initially opened, the standard error stream is not fully buffered; the standard input and standard output streams are fully buffered if and only if the stream can be determined not to refer to an interactive device

Timing of Makefile “include” statements for auto-generated files

时光总嘲笑我的痴心妄想 提交于 2019-12-25 09:45:54
问题 In this Makefile... all: piped.mk ifeq ($(PIPED),1) @echo Output of make is piped else @echo Output of make is NOT piped endif piped.mk: [ -t 1 ] && PIPED=0 || PIPED=1 ; echo "PIPED=$${PIPED}" > piped.mk .PHONY: piped.mk all include piped.mk ...I would expect the following: The first rule, all , says it depends on the file piped.mk . The file piped.mk is generated by asking the shell whether the terminal's stdout is a TTY or not The file piped.mk is include d at the end; in theory therefore

Attempting two-way communication between Python2.7 and ASP: writing contents of named pipe to a text file not working

流过昼夜 提交于 2019-12-25 08:36:55
问题 I'm using Python2.7, the SPARC ASP solver, and am running my code from the Ubuntu14.04 command line. I'm trying to set up two-way communication between my Python code and my ASP (answer-set-programming) code. To do this I am sending queries from python to ASP, putting the ASP response into a fifo pipe, and in the python code the contents of the fifo is read into a string and that string is then written to a text file (this is so that I can check the text file to see if I'm getting the output

Capturing tshark standard output with popen in C

自古美人都是妖i 提交于 2019-12-25 06:48:16
问题 I'm trying to capture the standard output from tshark through a program in C. For that, I use popen() call to open tshark process and read from the returned FILE stream. Code sample: #include <stdio.h> #include <stdlib.h> int main() { FILE* pipe_fd = popen("tshark -i eth0 -R icmp -2 -T fields -e icmp.checksum -e icmp.seq", "r"); //FILE* pipe_fd = popen("lsof", "r"); if (!pipe_fd) { fprintf(stderr, "popen failed.\n"); return EXIT_FAILURE; } char buffer[2048]; while (NULL != fgets(buffer,

Output from fortran application not showing up in Matlab

☆樱花仙子☆ 提交于 2019-12-25 05:18:28
问题 I'm having some issues with output from a fortran application being executed from within Matlab. We use Matlab to call a number of fortran applications and to display output and results. I'm using gfortran on OSX to build one of these programs, which does a large amount of file output and a little output to stdout to track progress. stdout output is accomplished mainly through print * statements, but I've tried write( * , * ) as well. The program uses OpenMP, but none of the print * or write(

Why is my machine writing stderr into stdout?

独自空忆成欢 提交于 2019-12-25 04:30:16
问题 While writing code against the System.Diagnostics.Process tools in C#, I was catching only StandardOutput and parsing it. However, a unit test around this failed on the build server. After a colleague tried on his machine, it failed as well. Then I found Jon Skeet's answer to a question about why StandardOutput was empty, and he mentioned capturing both StandardOutput and StandardError from System.Diagnostics.Process. Sure enough, we tried that on my colleague's machine and it worked. My

PHP Complete list of functions and statments that can output

一笑奈何 提交于 2019-12-25 04:13:07
问题 Note: "output" is meant to meant to data that streams out of php; Eg, stdout, output buffer, data that is returned to an incomming web request. "Output" is not to mean, the value that a functions that returns. Note: "function and statements" is meant to refer to anything that a php script can do ; What could approximately be referred to as a callable, or a statement; Or that PHP Docs refer to as a Language Construct. Or anything else that can in some way, make php output something somewhere.

Data integrity question when collecting STDOUTs from multiple remote hosts over SSH

断了今生、忘了曾经 提交于 2019-12-25 01:45:35
问题 Suppose you run the following commands: ssh $host1 'while [ 1 ]; do sleep 1; echo "Hello from $HOSTNAME"; done' > /tmp/output ssh $host2 'while [ 1 ]; do sleep 1; echo "Hello from $HOSTNAME"; done' >> /tmp/output ssh $host3 'while [ 1 ]; do sleep 1; echo "Hello from $HOSTNAME"; done' >> /tmp/output Then the output would look like: Hello from host1 Hello from host2 Hello from host3 Hello from host1 ... But what if I changed it to ssh $host1 'while [ 1 ]; do sleep 1; cat /some/large/file1.txt;

python: fork without an external command, and capturing stdout and stderr separately

别说谁变了你拦得住时间么 提交于 2019-12-24 23:08:02
问题 I'd like to fork a subprocess in python that does not run an external command ... it would just run a defined function. And I want to capture stdout and stderr separately. I know how to use os.fork() and os.pipe() , but that mechanism only gives me two fd's to work with. I'm looking for three fd's: one for stdin , one for stdout , and one for stderr . This is easy to manage using subprocess.Popen when running an external command, but that function doesn't seem to allow a local function to be

Bash eating stderr output

十年热恋 提交于 2019-12-24 20:23:08
问题 I'm calling a command line tool we wrote from bash on OS X and I have the problem that I don't get the stderr output but only printf's written to stdout. That's my call: echo "someInputString" |theTool -v someArg I also tried: echo "someInputString" |theTool -v someArg 2>&1 without success... I bet it's trivial but I don't know what needs to be done. Thanks in advance! 回答1: Redirect the stderr stream output with 2> . echo "someInputString" |theTool -v someArg 2> error_file 来源: https:/