I
Ian
What's a CString?Casper said:In scanning a drive and comparing file content, I need to remember
filepaths to every single file I encounter so I can take actions on
certain files later on.
Rather than having a huge list enumerating the complete filepath to
every file it seems the smarter way (faster, more memmory efficient) is
to model the filesystem treestructure in a abstract tree - and having
only the filenames & node pointer in an Array.
struct tree {
struct tree *parent;
struct tree *child;
CString filename;
};
Why use malloc?struct file {
CString name;
struct tree *path;
};
Does this sound like a good idea? Specifically, can I utilize an
existing data structure? What about stack/heap issues and tradeoffs?
Not being awfully experienced with trees and pointers, why won't this run:
struct tree *root;
root = ( struct tree * ) malloc ( sizeof( struct tree ) );
root->filename = "Test";
tree* root = new tree;
would be better.
Ian