I'd like to know if there is a way to write and output to a file AND have it output on the screen as well without too many lines of code.
I know how to output to console and how to output to file, but it is either one or the other, but I want to bond the two but so that I won't have to repeat the fprintf(stdout,__) once to output to file and once to output to console.
I am working in c.
Thanks in advance.
Edit: While I do also want to know how to do it within command line, I think showing it in code AND command line is important. Just to show two possible solutions to the problem. It should be also independent of any specific OSes... and doesn't look like tee is.