hi all,

I'm trying to make a C++ application that visualizes the computer structure (drivers, folders and subfolders, ...) in a 3D tree.
I want to access my hard disk to get its structure and use it.
How can I do so??
Is there a look-up table or something that stores all folders and subfolders in my computer disk?
Any other suggestions?

Thanks in advance : )

Many Thanks, Narue!
This is so useful for the searching feature that I'll make in my application.
But I still need to store the whole structure in my program.
the walker() function -in your link- is a slow solution to do this.
any other suggestions ?

Edited 6 Years Ago by niemo: n/a

the walker() function -in your link- is a slow solution to do this

You have benchmarks to prove that it's too slow for your application? Programmer's intuition is exceptionally poor at locating bottlenecks.

I think accessing the hard disk every time to get a file will be slower than getting all files from 1 access. That's what i meant by other suggestion.

Anyway, Thanks a lot!

I think accessing the hard disk every time to get a file will be slower than getting all files from 1 access.

The system API is generally good at making these queries efficiently. Your other option is to read it all one time and then cache the results, which is fine for file structures that don't change and woefully insufficient the rest of the time.

Personally, I think trying to read the world into memory is a bad idea in the first place. You'd be better off only keeping a subset in memory at once for your visualization. The subset should be large enough to avoid excessive disk access all at once and small enough to load quickly when disk accesses is necessary.

But good luck finding your magic function that enumerates all files and folders on a volatile file system with a single disk access. When you find it, let me know, because I could use it too.

This article has been dead for over six months. Start a new discussion instead.