This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

travirse the tree


Hey Now Gcc People,

I got a new one. This may not be the form for it but here goes...

So maybe u remember I was working w/ recursion. My recursive program
traverses the linux directory. Using g++ the recursive part works fine.

I am using readdir() to read the directory and stat() to let me know if
a file is a sub directory, symbolic link, or a file.

This seems to work until I get here:

/home/danny/.gnome/Desktop/Home Directory.

My program thinks Home Directory is a directory and not a symbolic link.
Thus this recursive program is doomed to infinite loopism!

I here is the code I use to test for symbolic link.

if  ( S_ISLNK(aFileStat.st_mode) || (aFileStat.st_mode & S_IFLNK ) )
  return 0;

As u c I have tried both methods of checking for a symbolic link and
both fail on this directory. Any ideas why?

Thanks
  Danny



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]