Hello,
So I have a string with a full filepath. However, I only want the immediate filename, without the full path. How can I remove the other bits or even just copy the part I want into another variable. Here is how it should work from what I can gather.
So now how can I copy the rest of the string AFTER the last '\'? What am I missing though, or is there an easier approach?Code:char file[] = "C:\\Users\\Administer\\Desktop\\doc.txt"; // find last occurence of '\' char *location = strrchr(file, '\'); // last occurence is now in location
In the end I would like to convert this
Code:char file[] = "C:\\Users\\Administer\\Desktop\\doc.txt"; /* to this */ char newName[] = "doc.txt";