Advertisement
Guest User

Untitled

a guest
May 24th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. #include <iostream>
  2. #include <sys/types.h>
  3. #include <dirent.h>
  4. #include <iostream>
  5. #include<iostream>
  6. #include<string>
  7. #include<cstdlib>
  8. #include<conio.h>
  9. #include<ctime>
  10. #include<stdlib.h>
  11. #include<stdio.h>
  12. #include<time.h>
  13. #include<math.h>
  14. #include<windows.h>
  15. #include<vector>
  16. #include<direct.h>
  17.  
  18. using namespace std;
  19.  
  20. void displayFolder(char* FolderName, vector<char*>& savedStuff);
  21. void displayVec(vector<char*> strVec);
  22.  
  23. int main(void)
  24. {
  25.  
  26. char folderName2[256];
  27.  
  28. cout << "What folder are the original files in?" << endl;
  29. cin.getline(folderName2, 256);
  30.  
  31.  
  32. vector<char*> myJawn;
  33. displayFolder(folderName2, myJawn);
  34. displayVec(myJawn);
  35.  
  36.  
  37. cin.ignore(cin.rdbuf()->in_avail()+2);
  38. }
  39.  
  40. void displayFolder(char* FolderName, vector<char*>& savedStuff)
  41. {
  42. DIR *dir = opendir(FolderName);
  43. if(dir)
  44. {
  45. struct dirent *ent;
  46. while((ent = readdir(dir)) != NULL)
  47. {
  48. //cout << (ent->d_name) << endl;
  49. savedStuff.push_back((ent->d_name));
  50. }
  51. }
  52. else
  53. {
  54. cout << "Error opening directory" << endl;
  55. }
  56. }
  57.  
  58. void displayVec(vector<char*> strVec)
  59. {
  60. for(int i = 0; i < strVec.size(); ++i)
  61. {
  62. cout << strVec[i] << endl;
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement