Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.61 KB | None | 0 0
  1. char** getFilesName(int* arg)
  2. {
  3.     char** names;
  4.     *arg = 0;
  5.    
  6.     names = (char**)calloc(50, sizeof(char*));
  7.     for(int i = 0; i < 50; i++)
  8.         names[i] = (char*)calloc(50, sizeof(char));
  9.    
  10.     WIN32_FIND_DATA winFileData;
  11.     HANDLE hFile;
  12.     char szPath[MAX_PATH];
  13.     if(GetCurrentDirectory(sizeof(szPath), szPath))
  14.     {
  15.         lstrcat(szPath,"\\db\\*.db*");
  16.         hFile = FindFirstFile(szPath,&winFileData);
  17.         if (hFile!=INVALID_HANDLE_VALUE)
  18.         {
  19.             do
  20.             {                  
  21.                 strcpy(names[*arg], winFileData.cFileName);
  22.                 *arg += 1;
  23.             }
  24.             while (FindNextFile(hFile, &winFileData)!=0);
  25.             FindClose(hFile);
  26.         }
  27.     }
  28.    
  29.     return names;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement