Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > displaying directory structure in c++

Reply
Thread Tools

displaying directory structure in c++

 
 
puneet vyas
Guest
Posts: n/a
 
      02-18-2009
hello, i have made an application which finds a directory detail like
folder count,file count etc but i am to display it in a XML that as a
hierarchy structure similar to windows structure,can any one suggest
how to do so. i know how to dump data in XMl but how to build that
hierarchy in xml ia m not getting














thanks puneet
 
Reply With Quote
 
 
 
 
Pascal J. Bourguignon
Guest
Posts: n/a
 
      02-18-2009
puneet vyas <(E-Mail Removed)> writes:

> hello, i have made an application which finds a directory detail like
> folder count,file count etc but i am to display it in a XML that as a
> hierarchy structure similar to windows structure,can any one suggest
> how to do so. i know how to dump data in XMl but how to build that
> hierarchy in xml ia m not getting


You will perhaps use a XML library. Or else you should write one.

You will then have a set of classes you can instanciate, element by
element, and attach together to form the XML tree. Finally you will
have a method to generate the XML tree into an XML file.

Perhaps something like:

XML::Element* rootDir=new XML::Element("directory");
rootDir->addAttribute("name","myBaseDirectory");
rootDir->addAttribute("fileCount","52");

XML::Element* file;

file=new XML::Element("file");
file->addAttribute("name","example.txt");
rootDir->addElement(file);

file=new XML::Element("file");
file->addAttribute("name","second.file");
rootDir->addElement(file);
....

XML::Root* docRoot=new XML::Root("1.0");
docRoot->addElement(rootDir);
docRoot->generateFile("dirs.xml");


--
__Pascal Bourguignon__
 
Reply With Quote
 
 
 
 
Sarath
Guest
Posts: n/a
 
      02-19-2009
On Feb 18, 1:49*pm, puneet vyas <(E-Mail Removed)> wrote:
> hello, i have made an application which finds a directory detail like
> folder count,file count etc but i am to display it in a XML that as a
> hierarchy structure similar to windows structure,can any one suggest
> how to do so. i know how to dump data in XMl but how to build that
> hierarchy in xml ia m not getting
>
> thanks puneet


This is not a C++ language related question but concerned with XML
library.

XML and Directory structure is identical. You can recursively iterate
directories, sub dirs and it's contents. If you knows a basic
understanding on XML and usage of XML LIbrary (MSXML or something
else) you can simply do that. Just google.
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.IO.Directory.GetDirectories() and System.IO.Directory.GetFiles() are not returning the specified directory Nathan Sokalski ASP .Net 2 09-06-2007 03:58 PM
Need help displaying file structure BW ASP .Net 3 04-13-2007 01:37 AM
Displaying a hierarchical folder / file structure Mark Rae ASP .Net 2 10-05-2006 01:02 PM
Directory structure of home directory? john HTML 4 06-15-2006 06:50 PM
Newbie: Displaying dir structure. AndyŻ HTML 5 11-10-2004 12:40 PM



Advertisments