mardi 27 octobre 2015

printing FILES then DIRECTORIES, no dirent.h

I am having trouble with some ordering. My code segment works properly however, I am having trouble listing all files and THEN all directories. I have been stuck on this for a few days experiencing with different ideas and have not got too far. Thank you guys!

do
{
    // DIR serach
    if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
        _tprintf(_T("%s  <DIR>\n"), ffd.cFileName);

    //else file search
    else
    {
        fileSize.LowPart = ffd.nFileSizeLow;
        fileSize.HighPart = ffd.nFileSizeHigh;
        _tprintf(_T("%s   %ld\n"), ffd.cFileName, fileSize.QuadPart);
    }

    // continue the search until no files
} while (FindNextFile(hFind, &ffd) != 0);

Aucun commentaire:

Enregistrer un commentaire