Fopen() and errno problem

So here is the main idea - I have to rewrite the CAT command and I bumped into a problem

void freadf(char *argv){
FILE* file1;;
char text[SIZE];
int argc=2;
errno = 0;

if(( file1 = fopen(argv, "r") ) <= 0 ){
if(errno == EACCES ) std::cout<<"Error access"<<std::endl; // EACCES
else if(errno == EISDIR ) std::cout<<"Error directory"<<std::endl;
else if(errno == ENOENT) std::cout<<"Error file"<<std::endl;
}
else{
while(fgets(text, SIZE, file1) != NULL){
printf("%s", text);
}
fclose(file1);
}
}

The problem is that I want errno to detect when i try to open a directory or try opening a no "all access free file" but it doest work - the return values are addresses - its just as how they should be - but for me thats not good. Please give me advice how to do this check...
Thinks in advance :)
Topic archived. No new replies allowed.