This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
travirse the tree
- From: danny <danny at 3rdplanetsoftware dot com>
- To: gcc gnu <gcc-help at gcc dot gnu dot org>
- Date: Sat, 27 Jul 2002 11:49:25 -0700
- Subject: 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