bonjour a tous alors voila j'ai un petit souci avec cette fonction, le findfirstfile retourne un invalid handle value et je ne sais pas a quoi c'est du si quelqu'un voit d'ou cela peut provenir je l'en remercie par avance. Voici mon code :
_tcscpy (DirSpec, rep);
_tcscat (DirSpec, _T("*.*"));
hFind = FindFirstFile(DirSpec, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
_tprintf (_T("Invalid file handle. Error is %u\n"), GetLastError());
CloseHandle(hFind);
return (-1);
}//end if
else
{
Name = FindFileData.cFileName;
_tcscpy(FileNameDebug,rep);
_tcscat(FileNameDebug,Name);
_TCHAR NewFileNameDebug[MAX_PATH];
_tcscat(NewFileNameDebug,_T("Zipper\\"));
_tcscpy(FileNameDebug,chaine);
_tcscat(NewFileNameDebug,Name);
CopyFile(FileNameDebug,NewFileNameDebug,0);
while (FindNextFile(hFind, &FindFileData) != 0)
{
Name = FindFileData.cFileName;
_tcscpy(FileNameDebug,rep);
_tcscat(FileNameDebug,Name);
_TCHAR NewFileNameDebug[MAX_PATH];
_tcscat(NewFileNameDebug,_T("Zipper\\"));
_tcscpy(FileNameDebug,chaine);
_tcscat(NewFileNameDebug,Name);
CopyFile(FileNameDebug,NewFileNameDebug,0);
}//end while
dwError = GetLastError();
if (dwError != ERROR_NO_MORE_FILES)
{
printf ("FindNextFile error. Error is %u\n", dwError);
CloseHandle(hFind);
return (-1);
}//end if
}//end else
CloseHandle(hFind);