GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 18-May-2005, 05:32
stuporglue stuporglue is offline
New Member
 
Join Date: May 2005
Posts: 2
stuporglue is on a distinguished road

*nix directory structure to tree object


I'm a C++ noob, and haven't done anything where I need to interact with the file structure yet. My environment is Mac OSX and Ubuntu Linux. I have some experience with Java, Bash scripting, and AppleScript.

I've found plenty of tutorials about how to read/write a single file, but I can't find anything on how to deal with a folder and it's sub-folders.

I want to take a folder (~/MyClipart) and create a recursive tree structure of it's contents.

The top level node would be ~/MyClipart. Each node would represent either a folder or a file. Of course folder-nodes could have child nodes.

I can handle making the tree, but I don't know how to get the file system info to populate the tree.

Thanks for the help,

Michael
  #2  
Old 18-May-2005, 08:34
Dr. Evil Dr. Evil is offline
Member
 
Join Date: Oct 2004
Location: Netherlands
Posts: 120
Dr. Evil will become famous soon enough
Use the opendir() set of functions, then you can check each file with stat() to see if it's a directory to recurse into.
  #3  
Old 18-May-2005, 08:46
Kacyndra's Avatar
Kacyndra Kacyndra is offline
Member
 
Join Date: May 2005
Location: Maryland
Posts: 230
Kacyndra will become famous soon enough
here is a good link, that should get you started in the right direction
http://www.codecomments.com/message222411.html
__________________
Xrum!
  #4  
Old 19-May-2005, 00:36
stuporglue stuporglue is offline
New Member
 
Join Date: May 2005
Posts: 2
stuporglue is on a distinguished road

Thank you


Thank you, that's just what I was looking for.

Michael
 
 

Recent GIDBlogNot selected for officer school by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying node attributes in an XML tree display njp01u MS Visual C++ / MFC Forum 2 07-Feb-2005 17:42
Apache2 config issues monev Apache Web Server Forum 2 28-Jun-2004 06:19
[CONTEST?]Data Structure Test dsmith C Programming Language 2 06-Jun-2004 15:13
Can't view pages from another machine on the Intranet aevans Apache Web Server Forum 9 14-May-2004 02:26

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 04:07.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.