Output to a new terminal

Suppose I created a stream from my "main" stream, which is designed to monitor and print some variables in "main". But "main" also generates some output, so I want to separately output the output of these two streams. How can I redirect the output of a new thread to a new console different from the one used by the "main" thread in my c program?

+3
source share
3 answers

I would output the monitoring information to a file and then use tail -f filenameto display it in my other terminal.

, grep what-have-you .

+2

, tail -f log_file.txt , , , , (tty), . , , , , .

, - , . - make. script, , cat tail .

#!/bin/sh
truncate  --size=0 ./logfile.txt
xterm "tail -f ./logfile.txt" 2>&1 > /dev/null &
your_program --log-file=./logfile.txt

.

, , , , - syslog.

+2

()?

, . , , ( ), .

- ?

0

Source: https://habr.com/ru/post/1776280/


All Articles