1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
WIN32_FIND_DATA FindFileData;
HANDLE hFind = INVALID_HANDLE_VALUE;
DWORD dwError;
LPCWSTR pb=L"C:\\Users\\Pictures\\*";
TCHAR name[60610];
TCHAR separateur[2]=L";";
// Find the first file in the directory.
hFind = FindFirstFile(pb, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
printf ("Invalid file handle. Error is %u.\n", GetLastError());
return (-1);
}
else
{
printf ("First file name is %s.\n", FindFileData.cFileName);
// List all the other files in the directory.
_tcscpy(name,separateur);
while (FindNextFile(hFind, &FindFileData) != 0)
{
_tcscat(name,FindFileData.cFileName);
_tcscat(name,separateur);
}
dwError = GetLastError();
FindClose(hFind);
}
char charname[60611];
char nameImage[256];
char* ptrchar=NULL;
char separ[2];
long somme=0;
int cpti=0;
double predictInter=-1;
separ[0]=';';
wcstombs(charname,name,60610);
ptrchar=strtok(charname, separ);
while(ptrchar!=NULL)
{
ptrchar = strtok(NULL, separ);
strcpy(nameImage,"C:\\Users\\Pictures\\");
if ((ptrchar!=NULL)&&(ptrchar[0]!='.'))
{
strcat(nameImage,ptrchar);
cvLoadImage(nameImage,CV_LOAD_IMAGE_COLOR)
cpti++;
}
} |
Partager