function to split a filepath into path and file

前端 未结 6 1531
猫巷女王i
猫巷女王i 2020-12-11 11:10

Lets say I have a function:

void split_path_file(char** p, char** f, char *pf)
{
    //malloc and set *p to file path, malloc and set *f to file name
    //p         


        
6条回答
  •  Happy的楠姐
    2020-12-11 11:38

    Go backwards through the string until you reach the first '\\' then set *f to everything after it and *p to everything before and the '\\'.

提交回复
热议问题