I'd do it like this:
The string S is passed to the tree, which in turn passes it to the root' function F():
Copy S from its start to before the first '/', or to its end, into S2. If a child named S2 doesn't exist, create it. If S doesn't contain a '/', return. Copy S from after the first '/' to the end into S3, and pass S3 to (the child named S2)->F(). Free the memory for S2 and S3 and return.
Of course, the nodes should have a map using char * as keys, and pointers to nodes as values.
Alternatively, they could have a char * as the name and a set to store its children.