fork download
  1. #include<stdio.h>
  2. #include<cstdlib>
  3. #include<iostream>
  4. #include<string.h>
  5. #include<fstream>
  6. #include<sstream>
  7. #include<dirent.h>
  8. using namespace std;
  9. void listFile();
  10.  
  11. int main(){
  12. listFile();
  13. return 0;
  14. }
  15. void listFile(){
  16. ifstream inn;
  17. string str;
  18. DIR *pDIR;
  19. struct dirent *entry;
  20. if( pDIR=opendir("./1") ){
  21. while(entry = readdir(pDIR)){
  22. if( strcmp(entry->d_name, ".") != 0 && strcmp(entry->d_name, "..") != 0 ){
  23. inn.open(entry->d_name);
  24. inn >> str;
  25. cout << str;
  26. }
  27. closedir(pDIR);
  28. }
  29. }
  30. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
Standard output is empty