You do not need to open the file. Your program has a special stdin value that contains a handle to the standard input of the process. You can use it in the same way as a file descriptor, for example:
int c = fgetc( stdin );
or
fread( somebuffer, somesize, 1, stdin );
source share