I am writing a c++ program on Linux (Ubuntu). I would like to delete the contents of a directory. It can be loose files or sub-directories.
Essentially, i would like to do something equivalent to
rm -rf <path-to-directory>/*
Can you suggest the best way of doing this in c++ along with the required headers. Is it possible to do this with sys/stat.h or sys/types.h or sys/dir.h ?!