As per my earlier post How to transform between a double date-time and std::string in C++, some things are surprisingly hard in C++, especially compared to writing in a .NET language. I recently tracked down this useful snippet of code on the internet in order to recursively build a list of files matching some file extension under a folder. This only compiles on Windows – if you want something cross-platform, look at boost (I wanted to avoid bringing the boost filesystem library into my project as yet another dependency).
void accumulate_files(
const std::string& folder,
const std::string& extension,
std::vector<std::string>& file_names )
{
std::ostringstream oss;
oss << folder << "\\";
std::string search_path = oss.str();
WIN32_FIND_DATA fd;
HANDLE hFind = ::FindFirstFile( search_path.c_str(), &fd );
if( hFind != INVALID_HANDLE_VALUE)
{
do
{
std::string file_name = fd.cFileName;
std::ostringstream full_file_name;
full_file_name << folder << "\\" << file_name;
if ( boost::algorithm::ends_with( file_name, extension ) )
{
file_names.push_back( file_name );
}
else if ( file_name != "." && file_name != ".." && !file_name.empty() )
{
// Recursively call into next directory
accumulate_files( full_file_name.c_str(), extension, file_names );
}
}
while( ::FindNextFile(hFind, &fd) );
::FindClose(hFind);
}
}
For production code, you’d also want to wrap the file handle in a smart pointer to ensure it gets closed properly for exception safety.
Having first read 


This John Corey thriller from Nelson DeMille has all the usual ingredients to make a great read – thrust Corey into a highly pressured world where gun play is the norm; include his wife, the lovely Kate Mayfield, to offset the crass and politically incorrect commentary from Corey; throw in an arch-villain as the nemesis for this adventure; finesse with conspiracy theories regarding Corey’s historical emnity with the CIA. The scene setting in Yemen was vivid and had the hallmarks of DeMille’s attention to detail, and yet, this book over-stayed its welcome by a couple of hundred pages. 
I first saw Chris Hadfield on the excellent 
This story was long awaited, partly because the author has been building up to the meeting of Jack Reacher with Susan Turner and his journey across America to Virginia for several books – this association started in the book 61 Hours, so definitely worth reading that one and before this. On the other hand, this book is one of the best Jack Reacher thrillers, so you might not want to wait. I was waiting to read this in paperback, but was delighted to receive it in a beautiful hardcover edition for my birthday.