graall
Messages postés27Date d'inscriptionmercredi 4 août 2004StatutMembreDernière intervention 2 novembre 2005
-
27 août 2005 à 17:09
graall
Messages postés27Date d'inscriptionmercredi 4 août 2004StatutMembreDernière intervention 2 novembre 2005
-
27 août 2005 à 20:04
HANDLE hfind;
WIN32_FIND_DATA wData;
char IncludePath[_MAX_PATH];
strcpy(IncludePath, include_dir); // copie du chemin vers le dossier
strcat(IncludePath, "*.*"); // ajout du type de fichier à lister
int nb_include = 0;
hfind = FindFirstFile(IncludePath, &wData);
if (hfind != INVALID_HANDLE_VALUE)
{
while (FindNextFile(hfind, &wData))
{
if (wData.cFileName[0] != '.')
{
nb_include++;
}
}
FindClose(hfind);
}
char *include_list[nb_include];
int counter = 0;
hfind = FindFirstFile(IncludePath, &wData);
if (hfind != INVALID_HANDLE_VALUE)
{
do
{
if (wData.cFileName[0] != '.')
{
include_list[counter] = new char[strlen(wData.cFileName)+1];
std::cout << wData.cFileName << std::endl;
counter++;
}
}while(FindNextFile(hfind, &wData));
FindClose(hfind);
}
}
Elle est prévue pour lister tous les fichier présents dans un répertoire. Le problème c'est qu'elle liste aussi les dossier :(