ftw and CTree



> >end use functions such as opendir(), readdir(), ...  These all have
> >manual pages e.g. man 3 opendir.
> 
> see also ftw(3) for an easy way to recursively walk a directory tree.


I read about this function in the libc info pages. Wow. It sounds too good
to be true.

How would I use it to recreate a directory hierarchy in my CTree
widget? Right now I have a recursive function: 

void build_tree(GtkWidget *button, GtkWidget *parent, GtkWidget *sibling,
	char path[])

that uses scandir and (S_ISDIR(status.st_mode)), but it does weird things,
like adds directory pixmaps when it is supposed to add file pixmaps (but
only sometimes). Also, it likes to insert file nodes on the tree before
subdirectory nodes, which I don't like.


Matt





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]