Is it possible to capture input from scanf(...) when I pipe my program to the tee function? For example, I have this program:
int main() {
int d;
printf("Enter a number: ");
scanf("%d", &d);
printf("Your number is %d\n", d);
}
When I execute the command ./a.out | tee out.txt, I see
7
Enter a number: Your number is 7
And out.txt is:
Enter a number: Your number is 7
How can I get the terminal and output file to both show:
Enter a number: 7
Your number is 7