Using ftw()
function, I have a list of paths I want to write on a file. I need only paths starting from a specified folder, like:
source folder: /Users/me
subfolder1: /Users/me/school
subfolder2: /Users/me/school/english
result I need: /school
/school/english
Is there a way to "subtract" one string from another, in the way i explained above? I know there is strtok()
function, but i don't know if it works with more than one char at a time.
Thanks.
如果您确定前缀在其中,请跳过它:
char *result = subfolder + strlen(source);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.