Search and read the file name in C++ or C

  c++, file, fileinfo

I have a scenario where I want to search my directory for all the files which have ".ip" in their filename and then read the filenames(I don’t need to open the file). I also need the time-stamp for each files and store them. I am using a Linux system and would like the solution to be in C++ or C.

Here’s what my directory looks like:

   ── server.linux.config
   ── linux.
   ── windows.
   ── local.
   ── server.bin
   ── keys.bin

For example, I need to need to read the filename "linux." since it has "ip" in its file name and get ip_address "", port no. "9000", system "linux" after reading the name and then the time-stamp of the file.

Source: Windows Questions C++