0

I have a small program written in C (school project) that is executed in the terminal.

This program will ask the user (with printf) to type input and will store it with scanf. The program itself works good.

If I redirect output to a file with >, the file is properly generated, and I can generate inputs with the terminal, but the console will not display the prints (they will be written in the file though, and that is also wanted).

I would like those printf() to be displayed WHILE the program is being executed so the user knows what type of input is being required.

I tried using tee, but that will print on the terminal after the program has been executed, so it is basically worthless in this case.

Thank you very much for your help.

eric
  • 43
  • 6

1 Answers1

0

Consider separating the output to stdout/stderr. The redirection will take all STDOUT to the output file. You program should then print progress information to stderr.

dash-o
  • 13,723
  • 1
  • 10
  • 37