Programming in c and c++

In this page

  1. Accessing the file system
    1. Linux
    2. Windows

1. Accessing the file system

Functions to access the file system are always a mess. And they are strongly dependent on the SO.

a. In Linux

For linux my preferred are the POSIX-2 standard impletations:

  • <glob.h>: has the most intuitive function with pattern matching included. So far, it does all I need. My wrapper (using STL) for it is in "filesdir.h".
  • <dirent.h>: A bit more complex and you have to do the pattern matching by yourself.
  • <fnmatch.h>: use this function to check whether a pattern matches a string or not.
  • <wordexp.h>: does the word expansions that the shell would do.

b. In Windows