I'm trying to use the nftw() function to calculate the size of a directory by the sum of some of the files. But how I do handle the sum if I cannot use global variables to store the sum of the sizes, and I have to use the function nftw()?
Recursive path of a directory with the nftw function in C
1.3k views Asked by J. Mendoza At
1
I've been investigating, and it is true that there is no way to pass a parameter to the nftw function to store the sum. But I've found a solution, but I do not know if it is very good.
My solution uses a "nested function" like the following: