Advertisement
obernardovieira

Encontrar os ficheiros numa pasta

Jun 13th, 2013
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <windows.h>
  2. #include <tchar.h>
  3. #include <stdio.h>
  4.  
  5. void _tmain()
  6. {
  7.     WIN32_FIND_DATA FindFileData;
  8.     HANDLE hFind;
  9.     BOOL WINAPI saida;
  10.  
  11.     hFind = FindFirstFile(TEXT("*.*"), &FindFileData);
  12.     _tprintf (TEXT("O primeiro ficheiro chamase %s\n"),FindFileData.cFileName);
  13.     for(int x=0;x!=15;x++) {
  14.         saida = FindNextFile(hFind,&FindFileData);
  15.         if (saida == 0)
  16.         {
  17.             _tprintf (TEXT("Nada"));
  18.         }
  19.         else {
  20.             _tprintf (TEXT("O proximo fixheiro chamase %s\n"),FindFileData.cFileName);
  21.         }
  22.     }
  23.     FindClose(hFind);
  24.     system("pause");
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement