Discussion on stackoverflow pointed that fseek or ftell would fail. But on my system it's not true, ftell(f, 0, SEEK_END) returns size of opened directory.
Only when we trying to read data using fread or fgetc the errno variable is set to EISDIR error code.
Here is output from simple test program:
$ ./a.out ~ testing '/home/wojtek'... fopen: Success [errno=0] fseek: Success [errno=0] fseek result: 0 ftell: Success [errno=0] ftell result: 24576 feof: Success [errno=0] feof result: 0 (EOF=no) fgetc: Is a directory [errno=21] fgetc result: -1 (EOF=yes) fread: Is a directory [errno=21] fread result: 0
Brak komentarzy:
Prześlij komentarz