In C how do I print filename of file that is redirected as input in shell
You can’t get the filename exactly as input; the shell will handle all that redirection stuff without telling you. In the case of a direct < file redirection, you can retrieve a filepath associated with stdin by using fstat to get an inode number for it then walking the file hierarchy similarly to find / … Read more