Even here, I saw this post that does't work for me, because I can't use readdir() since dir.h and dirent.h are not available on VC++ 2008:
srini (3) Aug 11, 2008 at 3:09am
hi,
how can i read the contents of directory.
suppose a directory is having some .txt files. now i want to read all the file one by one. how can i implement a code in c++.
Thanking you,
srinivas.
|
jsmith (958) Aug 11, 2008 at 10:47am
Use opendir() and readdir(). (man 3 opendir and man 3 readdir).
Continue calling readdir() until it returns NULL. Each call to readdir returns the "next" directory entry. Be aware that readdir() will return "." and ".." as directory entries...