dirent.h not returning all items

590 views Asked by At

I am currently developing C++ applications using Visual Studio 9 and some QT tools. My dirent version is 1.13. I can't remember if I got this version together with my VS installation or I replaced it with the one I have in my downloads folder.

Anyway, My application is using the code below to get user input of a selected mapped network drive that I will scan for subdirectories. The approach below does not return all items though. There are only 112 subdirectories at the moment but the loop only gets 101 items including the "." and ".." items. Anyone here who has encountered this before or has a suggested remedy?

Thank you.

DIR *dir1;
struct dirent *ent1;
QByteArray ba;
QString directory = QFileDialog::getExistingDirectory(this,
tr("Find Files"), QDir::currentPath());

QDirIterator dirIt(directory,QDirIterator::Subdirectories);

ba = directory.toLocal8Bit();

if ((dir1 = opendir (ba.data())) != NULL) 
{
   ctr = 0;
   while ((ent1 = readdir (dir1)) != NULL) 
   {
      ctr++;
      qDebug()<<ctr<<". "<<ent1->d_name;
   }
}
0

There are 0 answers