I’m working on POSIX linux to learn. I’m using C Programming Languages.
I want to read a folder, but instead of using readdir or opendir, I want to use pure open and read, I want to extract subfolders or files in this folder as names as string.
Is this possible with open() and read() as open and read (without using dirent.h)?
Advertisement
Answer
Simply put: no, it’s not.
open()
and read()
operate on files, not directories.
opendir()
and readdir()
operate on directories, not files.