Stephen Kratzer wrote: > On Wednesday 25 April 2007 08:45:27 Nikola wrote: > >> Hi, >> >> I am trying to parse dir tree with ftw and nftw on Linux (debian) but >> without result. >> >> ------------------------------------------------------ >> >> #include <stdio.h> >> #include <ftw.h> >> >> >> int fn(const char *file, const struct stat *sb, int flag){ >> >> printf("-->\n"); >> } >> >> >> int main(int argc,char **argv){ >> >> >> ftw("/etc/", fn, 5); >> >> return 0; >> } >> >> ------------------------------------------------------ >> >> bash# gcc test.c >> bash# ./a.out >> --> >> bash# >> >> ------------------------------------------------------ >> >> Does anyone knows what might be the problem. >> >> tnx in advance. >> >> > > The return value of fn should be 0 if you want the walk to continue past the > first file or directory. > and compiling with warning outputs could have helped, too :) $ gcc -Wall test.c surely leads to a "control reaches end of a non void function" or something similar... Ben -- Purple Labs S.A. www.purplelabs.com - To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html