open function in my code doesnot work.
I already search stackoverflow and find a possible solution
if ((fd = open(*argv, 0)) < 0) {
if(fd == -1)
{
switch( errno )
{
case EACCESS: // permission issues
handle_permission_issue();
break;
case EEXIST: // file already exists and you used O_CREAT and O_EXCL
handle_already_exists_issue();
break;
case EFAULT: // bad path
handle_bad_path_issue();
break;
}
printf("file read failedn");
}
printf("could not open(%s)n", *argv);
return -1;
}
but clion redden the code though I include the <errno.h>.
the imagine is as follows.
I want to get a solution to open filename correctly.