$cc a.c
$./a.out < inpfilename
I want to print inpfilename on stdout. How do I do that ? Thanks for the help in advance...
As you put it the process that runs a.out has no notion of the file name of the file that provides its' standard input.
The invocation should be:
$ ./a.out inputfilename
and parse argv in int main( int argc, char* argv[] ) { ... }
or
$ ./a.out <<< "inputfilename"
And get the filename from stdin.
Then in a.c you need to fopen that file to read it's content.