Here is a function to get all the file names in the folder , Go straight to the code .

Original address :http://blog.csdn.net/qqmcy/article/details/36184733

  1. //
  2. //  VisibleRect.cpp
  3. //  Test890
  4. //
  5. //  Created by  Dujia  on 14-4-28.
  6. //
  7. //
  8. std::vector<std::string> VisibleRect::getFilePathAtVec(std::string filePath)
  9. {
  10. std::vector<std::string> path_vec;
  11. const char* path = filePath.c_str();
  12. char *dir = (char*)malloc(filePath.size() + 1);
  13. sprintf(dir,  path);
  14. DIR *dp;
  15. struct dirent *entry;
  16. struct stat statbuf;
  17. int i=0;
  18. if((dp=opendir(dir))==NULL)
  19. {
  20. fprintf(stderr,"cannot open %s",dir);
  21. exit(1);
  22. }
  23. chdir(dir);
  24. while((entry=readdir(dp))!=NULL&&i<255)
  25. {
  26. stat(entry->d_name,&statbuf);
  27. if(!S_ISREG(statbuf.st_mode))
  28. continue;
  29. path_vec.push_back(StringUtils::format("%s",entry->d_name));
  30. }
  31. return path_vec;
  32. }

cocos2d-x3.2 To get all the file names under the folder

  1. C# Get all the files in the specified format under the folder

    C# Get all the files in the specified format under the folder , Although it's very simple , But share it , It can be used with a little modification and optimization . Get all the files in the specified directory // The most important thing is to use System.IO.Directory.GetFil ...

  2. C++ Get all the file names in the folder

    Getting all the file names in a folder is a common function , Once again today there is such a demand , So I searched a lot on the Internet , And write it down for later use . original text :http://blog.csdn.NET/cxf7394373/article/detai ...

  3. Qt Get all the files in the folder

    Qt Get all the files in the folder. The code is as follows : QStringList getFileNames(const QString &path) { QDir dir(path); QStringList n ...

  4. JAVA Get all the files in the folder

    package com.test; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; im ...

  5. Wechat app cloud development gets all the files in the folder

    Last week a high school classmate asked me to help him make a public official account of the picture , Because I've been working overtime , So I forgot , When I thought of it last night, I worked overtime to help him , There's a problem , Make a note of . His need is to have a backstage to upload pictures to him and classify them , Front end public ...

  6. Use boost Library gets the names of all the files in the folder

    Recently, I found a useful code fragment that I have been looking for for for a long time , Is to get the name of all the files in the folder , And the absolute path of the current file . Make a note of . It uses boost library , #include <boost/filesystem ...

  7. Windows Batch rename all the pictures in the folder ( attach C++,python,matlab Code )

    https://blog.csdn.net/u011574296/article/details/72956446: Windows Batch rename all the pictures in the folder ( attach C++,python,matlab ...

  8. Reprint : C++ Get all the file names in the folder

    Recently, you need to get all the file names in a folder , So I checked it on the Internet , Get the following solutions at most : And the earliest version found is this :http://blog.csdn.net/cxf7394373/article/detai ...

  9. 【C#】C# Get all the files in the folder

    # Basic knowledge of 1. Gets the path of the currently running program string rootPath = Directory.GetCurrentDirectory(); 2. Get the files in this folder , The return type is FileInfo st ...

Random recommendation

  1. Hibernate Configuration file for

    Hibernate The configuration file •Hibernate Configuration files are mainly used to configure database connections and Hibernate Various properties required for runtime • Every Hibernate The configuration file corresponds to a Configuration ...

  2. MVC in Jqgrid Usage of

    Jqgrid The acceptable data source format is usually local.json.string etc. , And we passed MVC Controller Query the database (Linq) It usually translates into tolist(), for example : public object ...

  3. JavaScript Node operation Dom Properties and methods ( turn )

    JavaScript Node operation Dom Properties and methods   Some commonly used dom Properties and methods , Listed as a manual . attribute :   1.Attributes A list of properties of the storage node ( read-only )   2.childNodes Storage ...

  4. Commonly used UI Layout

    1.LinearLayout( Linear layout ): Arrange the controls contained in the layout in a linear direction . <1>android:orientation The direction of the arrangement is specified ( vertical direction (vertical). horizontal direction (h ...

  5. python Reading and writing zip file

    zipfile.ZipFile(fileName[, mode[, compression[, allowZip64]]]) fileName There is no doubt about it . mode Just like normal file operation ,'r' ...

  6. distributed file system FastDFS Introduction and configuration process

    http://ylw6006.blog.51cto.com/470441/948729/ Due to the use of the website nfs Share to save the pictures uploaded by users , Attachments and other information , And then through apache Download the way for users to access , In website architecture ...

  7. Count Color Line segment tree

    Count Color Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit  ...

  8. CSS The box model of ( In depth understanding of )

    CSS-- Box model (Box Model) brief introduction : CSS The box model is essentially a box , For the vast majority of web pages HTML Elements for packaging positioning ( Margin , Frame , Inside margins and actual content ). But not all HTML You can see all the elements ...

  9. Java The mistakes and experience of exception handling

    Java The mistakes and experience of exception handling   1 This paper mainly introduces Java Some mistakes in the selection and use of exceptions , I hope you can master some points and principles of exception handling , Pay attention to summary and induction . Only when the exception is handled , To improve developers ...

  10. Oracle EBS INV Create a location

    create or replace PROCEDURE XX_CREATE_LOCATOR AS -- Common Declarations l_api_version NUMBER := 1.0; ...