0

In my project i need to read few files but i only know part of their name, for example:

  • pacman01.screen.txt
  • pacman02.screen.txt
  • pacman03.screen.txt

The file name has to contain the ending (.screen) but the start may change. how can i open those files in lexicographically order.

thanks!

HenSinai
  • 25
  • 5
  • 3
    [The filesystem library](https://en.cppreference.com/w/cpp/filesystem) (added in the C++17 standard) will help you get a list of files. Then you can use a simple filter to filter out files not matching your requirements. Then sort the remaining files. – Some programmer dude Dec 09 '21 at 08:50
  • There is a possible [dup](/questions/68098966/find-files-by-pattern) here, but it does more than you need (it searches a whole hierarchy) – Botje Dec 09 '21 at 08:51

0 Answers0