c++ How to check if there is a file in a directory quick way? -


what trying when directory has no write permission , if directory contains @ least 1 file trying print out "permission denied"

dir *dir; dir = opendir (argv[i]); if (!(sb.st_mode & s_iwusr) && (readdir(dir) != null)) {     printf("rm: cannot remove ");     printf(argv[i]);     printf(": permission denied\n");  } 

this trying do, prints out messages when there no files... suggestions?


Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -