I want to open a directory without using <dirent.h>. I tried this:
#include <fcntl.h>
int fd = open("dir", O_RDONLY, 0);
But it returns fd = -1. Why? As I know, the directory is a file too, it just stores the location of children files and directories.