摘要: 1. 将绝对路径转换成相对路径。例如, input: /home/news/../tmp/game/../; ouptut: /home/tmp/ 思路:利用栈的思想。每次遇到".."时,将退栈至上一个'/'位置。 1 #include 2 #include 3 #include 4 5 char *convert_path_opt( const char *path ) 6 { 7 char *result = NULL; 8 int top = 0; 9 int path_len = 0,10 index ... 阅读全文
posted @ 2013-09-11 09:02 life91 阅读(2620) 评论(5) 推荐(5) 编辑