I currently have a char array that is storing a filename.
eg. folder1/subfolder/subsubfolder/file1.txt
I want to be able to remove the first folder name in this char array. so it becomes
subfolder/subsubfolder/file1.txt
I know that basename() will make the output file1.txt but I need the folder structure, just not the first one.
What is the best way to do it? use /
as a delineating character?
- Edit * Ok apparently I can't ask about a char array without going in to detail about my whole freaking program lol.
I would like to know is if there is a simple way to shorten a char array from the beginning. I am working on a file copying program and it would just make my life a lot easier if I can shorten the full file location by discarding the first folder name. I am a complete noob when it comes to programming and thought this might have been an easy one to solve for the wizards on this site. I didn't put code in my initial post because I don't know if the is even a function that does what I'm asking. So apologies. But if you have to have code then here...
strcpy(sourcePath, Path);
strcat(sourcePath, slash);
This obviously doesn't do what I need it to do.