I'm trying to examine the data that fopen() returns. But I fail in reading out the data to which the pointer points.
#include <stdio.h>
int main( void )
{
FILE * file = fopen("file.txt");
printf( "%#llx,\n", (long long) (*file) );
}
with gcc, I get this error at compiling:
6:5: error: aggregate value used where an integer was expected
6 | printf( "%#llx,\n", (long long) (*file) );
| ^~~~~~
clang throws
6:37: error: operand of type 'FILE' (aka 'struct _IO_FILE') where arithmetic or pointer type is required
printf( "%#llx,\n", (long long) (*file) );
^~~~~~~
So why fails the cast, and how to fix this?