C语言截取字符串

 1 void subString(char filePath)
 2 {
 3        int len = strlen(filePath);
 4        int num, n;
 5        char buf[128] = {0};
 6        char cutOff[128] = {0}; 
 7      
 8        strcpy(buf, filePath);
 9        for(num = len - 1; num > 0; num--){
10              if(buf[num] == "\\")
11              {
12                    n = num;
13                    for(num = n+1; num < len; num++){
14                          cutOff[num-n-1] = buf[num];
15                    }    
16                    break; 
17              }  
18       }       
19 }    
View Code

 

posted on 2016-08-14 23:05  jiangsion  阅读(496)  评论(0编辑  收藏  举报

导航