I have
char *path;
and I store the string "/home/juggler/file1.txt" in path. How do I truncate path so that I just have the parent of the last file/directory? In the example I would like to truncate path to "/home/juggler"
I was thinking of counting the number of characters(count) from the end to the last "/" and the copy the (length of path)-(count) to another string.
Thanks