Why does fopen(“any_path_name”,'r') not give NULL as return?
问题 While debugging some code I got something like below: #include<stdio.h> int main() { FILE *fb = fopen("/home/jeegar/","r"); if(NULL == fb) printf("it is null"); else printf("working"); } Here in fopen I gave a somewhat valid path name but not a filename. Shouldn't fopen return NULL then? But it does not return null! Edit: If I give path of valid directory in fopen then it will print working : If I give path of invalid directory in fopen then it will print it is null Edit: spec says Upon