mardi 30 juin 2015

recursive deleting file linux C (discussion)

I am referring this question to the stackoverflow Answer How to clear directory contents in c++ on Linux (basically, i want to do 'rm -rf <directorypath>/*' . I just want to know few things which i was failed to interpret i.e is about nftw() and unlink_cb(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf).

Related to nftw(path, unlink_cb, 64, FTW_DEPTH | FTW_PHYS); i was able to understand whats the purpose of the parameter in nftw() through man nftw, and but i got confused that whats the purpose of these parameters in unlink_cb():

const struct stat *sb; ??

int typeflag; // which is FTW_DEPTH | FTW_PHYS ? is that correct?

struct FTW *ftwbuf; ??

Anyon who can explain it to me.

Aucun commentaire:

Enregistrer un commentaire