Sample Header Ad - 728x90

reading stdout from /proc

1 vote
0 answers
30 views
I'm running the following C program
// hello.c

#include 
#include 

int main() {
  while (1) {
    printf("Hello\n");
    fflush(stdout);
    sleep(1);
  }

  return 0;
}
I launched the program using
./hello
and I can see on the terminal its messages. Then I get its pid using. However if I do
tail -f /proc//fd/1
I do not get anything. Ditto if I use
cat /proc//fd/1
I think that I probably misunderstood some concepts about stdout and /proc. It is possible to do what I'm trying to do?
Asked by MaPo (319 rep)
Apr 4, 2025, 10:04 AM