Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. // Tema1.cpp : This file contains the 'main' function. Program execution begins and ends there.
  2. //
  3.  
  4. #include <iostream>
  5. #include <Windows.h>
  6. #include <cstring>
  7. #include <string.h>
  8.  
  9. using namespace std;
  10.  
  11.  
  12. void parcurgere(char* director) {
  13. cout << "We are in " << director << endl;
  14.  
  15. WIN32_FIND_DATA find_data;
  16. HANDLE hDir = FindFirstFile(director, &find_data);
  17. director[strlen(director) - 1] = '\0';
  18.  
  19. while (FindNextFile(hDir, &find_data)) {
  20. if ((find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0 && strcmp(find_data.cFileName,"..")!=0)
  21. {
  22. cout << find_data.cFileName<<endl;
  23.  
  24. char* next_path = new char(1000);
  25. //cout << director << endl;
  26.  
  27.  
  28.  
  29.  
  30.  
  31. strcpy(next_path,director);
  32. //cout << next_path;
  33.  
  34.  
  35. strcat(next_path,find_data.cFileName);
  36.  
  37. strcat(next_path,"\\*");
  38. //cout << next_path << endl;
  39.  
  40. //strcpy_s(path, strcat(strcat(director, "\\"), find_data.cFileName));
  41. //cout << find_data.cFileName<<endl;
  42. parcurgere(next_path);
  43. }
  44. }
  45. }
  46.  
  47. int main(int argc, char*argv[])
  48. {
  49. char DirectoryName[1000];
  50. strcpy_s(DirectoryName, argv[1]);
  51. strcat_s(DirectoryName, "\\*");
  52. parcurgere(DirectoryName);
  53.  
  54. }
  55.  
  56. // Run program: Ctrl + F5 or Debug > Start Without Debugging menu
  57. // Debug program: F5 or Debug > Start Debugging menu
  58.  
  59. // Tips for Getting Started:
  60. // 1. Use the Solution Explorer window to add/manage files
  61. // 2. Use the Team Explorer window to connect to source control
  62. // 3. Use the Output window to see build output and other messages
  63. // 4. Use the Error List window to view errors
  64. // 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
  65. // 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement