简体   繁体   中英

C++ : How can I read all jpg files in a directory?

How can I read all jpg files in a directory? These files are the frames of a film and their names are "0000.jpg" , "0001.jpg" ,... .

Are you looking for something like dir *.jpg or ls *.jpg ? In case you want to use boost in a form:

BOOST_FOREACH( const std::string& fname, ls( "./*.cpp" ))
    std::cout << fname << std::endl ;

You can use the ls function you can find here: http://greg-n-blog.blogspot.com/2010/01/ls-using-boost.html

libjpeg is a popular jpeg decoder library

enumerating a directory can be done with a class in the boost library called:

boost::filesystem::directory_iterator 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM