Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to specify nftw flags

Tags:

flags

nftw

This is my nftw function, it works correctly before specifying flags FTW_DEPTH and FTW_PHYS:

if (nftw(argv[1], visit, 64, FTW_DEPTH | FTW_PHYS) != 0) 
{
    perror("nftw");
}

Also I have defined visit as:

int visit(const char *path, const struct stat *stat, int flags)
{
    ...
    return 0;
}

BUT after compilation it gives error:

‘FTW_DEPTH’ undeclared (first use in this function)

like image 816
Survi Makharia Avatar asked Aug 31 '25 03:08

Survi Makharia


1 Answers

Try using #define _XOPEN_SOURCE 500 before including ftw.h

like image 79
Jaydeep Avatar answered Sep 06 '25 21:09

Jaydeep