UNIX & GNU/Linux - System calls - readdir()
The readdir() system call function is used to read into a directory. The function returns a pointer to a dirent structure. This structure contains five fields but only two are POSIX standard, this is the d_name and the d_ino member. That’s the first we will use in our readdir() example. Before starting, let’s create some files. We need a folder named hello. In the hello directory, let’s create three new files: a folder named one and two files named girl and boy. ...