Questions tagged [stdout]

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

4740 questions
29
votes
1 answer

How to configure logs/catalina.out of tomcat 6 for per-app. (Configure web-app specific log file for sys.out, sys.err)

Requirement is this ... We have our 3 web-applications deployed in RHEL-5 server, we deployed apps with tomcat 6.0.16. We want to configure stdout, stderr, which are coming in tomcat/logs/catalina.out in app specific log file like,…
Garudadwajan
  • 689
  • 4
  • 11
  • 24
29
votes
3 answers

C restore stdout to terminal

I am working with a multi-thread program. First I redirect my stdout to a certain file. No problem there (I used dup2(fd, 1) where fd is the file descriptor for the file). Afterwards, I need to redirect my stdout to the terminal again. My first…
Alessandroempire
  • 1,640
  • 4
  • 31
  • 54
28
votes
2 answers

How to get STDOUT from a QProcess?

I thought I was going to get the output from a QProcess using the following code: // Start the process process.start(tr("php-cgi www/test.php"),QIODevice::ReadWrite); // Wait for it to start if(!process.waitForStarted()) return 0; // Continue…
Nathan Osman
  • 71,149
  • 71
  • 256
  • 361
28
votes
1 answer

Using tee to get realtime print statements from python

I have a python script that looks something like this: for item in collection: print "what up" #do complicated stuff that takes a long time. In bash, I run this script by doing the following: $ python my.py | tee my_file.txt However, all I…
robert
  • 1,402
  • 1
  • 15
  • 21
27
votes
2 answers

Why does 'java -version' go to stderr?

Is there any special reason for the results of java -version going to stderr? For example, this command executed from Windows' prompt line: java -version > java_version.txt leaves the file java_version.txt empty. EDIT: The same happens with the…
Jagger
  • 10,350
  • 9
  • 51
  • 93
26
votes
1 answer

Is stdout line buffered, unbuffered or indeterminate by default?

Section 7.19.3/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…
paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
26
votes
2 answers

Notice: Use of undefined constant STDOUT - assumed 'STDOUT'

I am trying to set up Amazon Aws Php SDK in Xampp. After installing the SDK, I am trying to download a bucket from Amazon S3, using the following code.
SatheeshJM
  • 3,575
  • 8
  • 37
  • 60
26
votes
4 answers

How to read QProcess output to QString?

I have a code that uses QProcess like this : int main(int argc, char *argv[]) { int status=0; QProcess pingProcess; QString ba; QString exec = "snmpget"; QStringList params; params << "-v" << "2c" <<…
sersem1
  • 466
  • 1
  • 4
  • 10
26
votes
2 answers

Capturing SSH output as variable in bash script

I've been struggling with this problem when writing a bash script. Basically, I want to measure the time of a program on a remote server, so I use the command: /usr/bin/time -f %e sh -c "my command > /dev/null 2>&1" to execute the program. However,…
Andy Dang
  • 1,649
  • 3
  • 14
  • 9
25
votes
5 answers

Writing to stdin and reading from stdout (UNIX/LINUX/C Programming)

I was working on an assignment where a program took a file descriptor as an argument (generally from the parent in an exec call) and read from a file and wrote to a file descriptor, and in my testing, I realized that the program would work from the…
Tim
  • 301
  • 1
  • 5
  • 8
25
votes
7 answers

stdout and need to flush it C++

I have some C++ code that uses cout statements for debug purposes and for some reason I can't get all the data to print unless I do a std::cout.flush(); at the end. I don't quite understand why this flush operation is needed. Anyone have any…
Dixon Steel
  • 1,021
  • 4
  • 12
  • 27
25
votes
2 answers

Intercepting stdout of a subprocess while it is running

If this is my subprocess: import time, sys for i in range(200): sys.stdout.write( 'reading %i\n'%i ) time.sleep(.02) And this is the script controlling and modifying the output of the subprocess: import subprocess, time, sys print…
Paul
  • 42,322
  • 15
  • 106
  • 123
25
votes
5 answers

How do you tell Spring Boot to send the embedded Tomcat's access logs to stdout?

In a standalone Spring Boot web application (executable jar), how do you tell Spring Boot that we want the embedded Tomcat instance's HTTP access logs to be sent to stdout?
Les Hazlewood
  • 18,480
  • 13
  • 68
  • 76
25
votes
4 answers

Why does printf() not print anything before sleep()?

I'm just learning C with Kernighan and Ritchie's book; I'm in the basics of the fourth chapter ("Functions and Program Structure"). The other day I became curious about the sleep() function, so tried to use it like this: #include #include…
John Woods
25
votes
2 answers

How to test print statements?

You want to write unittest-cases for a function like that: def test_me(a): for b in c: print do_something(a,b) At first I thought about just collecting the outputs of do_something in a string and then returning it, to print and test the…
erikbstack
  • 12,878
  • 21
  • 81
  • 115