I have a problem with this function :
dirp = opendir(ruta);
if (dirp != NULL){
while ((direntp=readdir(dirp)) != NULL) {
stat(ruta, &estructura);
Sorry for my English ... i hope that you can understand me
Thanks, the funcion works perfectly!
I changed my code for this:
while ((direntp=readdir(dirp)) != NULL) {
sprintf( cwd, "%s/%s", ruta, direntp->d_name );
stat(cwd, &estructura );
Thanks for your help and sorry to write here but i cant write a comment in 7 h. Thanks!!!!!!!
thank you
You always call stat
for the directory itself.
This ...:
while ((direntp=readdir(dirp)) != NULL) {
stat(ruta, &estructura);
...
}
... should be something like:
while ((direntp=readdir(dirp)) != NULL) {
char pathname[1024];
sprintf( pathname, "%s/%s", ruta, direntp->d_name );
stat( pathname, &estructura );
...
}