Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] stdout redirection



Hi,

I have a (C) program ("myprog") which outputs messages to stdout and
stderr while running. If I invoke the program without any args, both
stdout and stderr are shown in the console:
$ myprog
If I want to redirect the output to files, it is just matter of doing
something like
$myprog 1>log_stdout.txt 2>log_stderr.txt

However I have the following problems:

1) In the case the program does not return (i.e., waiting for a
message or something, need to use Ctrl-C to terminate it),
log_stdout.txt is empty (however log_stderr.txt correctly has the
redirected stderr messages).  This is weird for me because if I just
do
$myprog 2>log_stderr.txt
stdout messages are shown in the console. Is this behavior normal? Is
it possible to change this?

2) How can I do in order to show the messages both in the console and
also to save those in a file?

Thanks,
Hector


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links