ALEXSNIPER
May 17th, 2010, 03:27 PM
i have questions about file system
the first one is how i can list all file in directory
i tried to do this but it lists directories only not files
void ListFiles(TCHAR szDirectory[])
{
WIN32_FIND_DATA findData;
HABDLE hfind;
BOOL bMoreFiles=TRUE;
hFind=FindFirstFile(szDirectory,&findData);
if(findData.dwFileAttributes ==FILE_ATTRIBUTE_ARCHIVE)//FILE
{
while(bMoreFiles)
{
wcout<<findData.cFileName;
bMoreFiles=FindNextFile(szDirectory,&findData);
}
}//if
else if(findData.dwFileAttributes ==FILE_ATTRIBUTE_DIRECTOR)Y //directory not file
ListFiles(findData.cFileName);//using recursion
else
return ;
}//ListFiles()
the second one is
let's say i want to show all images in directory
how can i know the type of the file (file extension)
thnx
the first one is how i can list all file in directory
i tried to do this but it lists directories only not files
void ListFiles(TCHAR szDirectory[])
{
WIN32_FIND_DATA findData;
HABDLE hfind;
BOOL bMoreFiles=TRUE;
hFind=FindFirstFile(szDirectory,&findData);
if(findData.dwFileAttributes ==FILE_ATTRIBUTE_ARCHIVE)//FILE
{
while(bMoreFiles)
{
wcout<<findData.cFileName;
bMoreFiles=FindNextFile(szDirectory,&findData);
}
}//if
else if(findData.dwFileAttributes ==FILE_ATTRIBUTE_DIRECTOR)Y //directory not file
ListFiles(findData.cFileName);//using recursion
else
return ;
}//ListFiles()
the second one is
let's say i want to show all images in directory
how can i know the type of the file (file extension)
thnx