This is something I've been struggling with theoretically, but haven't found any good answers online. I've written programs with binary trees before, which were easy: each node had two links. But now I'm planning out a filesystem based on trees for a project, and I'm not sure how to proceed. Here's the trouble:

I want a tree that has pointers to files for leaves and subdirectories for internal nodes (I think this is how Unix does it?). But if a user wants to create a new file or directory, then the number of links in the parent node must be increased.

How can I account for this when I design my struct? I'm not sure what my options are besides hardcoding, say, 10 links and restricting directory members to that. Any pointers? (Hah, get it?)

If not, does anybody know of any good resources where I could learn more about this? Like I said, so far my internet searches have been fruitless.