TheDuliX_

Untitled

Sep 12th, 2021 (edited)
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #include <dirent.h>
  2. #include <stdio.h>
  3. #include <vector>
  4. #include <string>
  5. #include <iostream>
  6. #include<fstream>
  7.  
  8. using namespace std;
  9. std::vector<std::string> fileName;
  10.  
  11.  
  12. int main(void)
  13. {
  14. char* appdata = getenv("APPDATA");
  15. char* dalje = getenv("APPDATA");
  16.  
  17. DIR *d;
  18. struct dirent *dir;
  19. vector<string> fileList;
  20. int i=0;
  21. d = opendir(appdata);
  22.  
  23. if (d)
  24. {
  25. while ((dir = readdir(d)) != NULL)
  26. {
  27. i++;
  28. fileList.push_back(dir->d_name);
  29. }
  30. for(int i=0;i<fileList.size();i++) {
  31. cout<<fileList[i]<<endl;
  32.  
  33. }
  34. closedir(d);
  35. }
  36. system("pause");
  37. }
  38. // #include <stdlib.h>
  39. // #include <stdio.h>
  40.  
  41. // int main(int argc, char** argv){
  42. // char* appdata = getenv("APPDATA");
  43. // printf("Appdata: %s\n",appdata);
  44. // return 0;
  45. // }
  46.  
Add Comment
Please, Sign In to add comment