Mohammad
Mohammad

Reputation: 11

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" ,... .

Upvotes: 1

Views: 1332

Answers (2)

cppguy
cppguy

Reputation: 3713

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 

Upvotes: 1

Grzegorz
Grzegorz

Reputation: 3335

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

Upvotes: 1

Related Questions