cout< } else{ cout.setf(2); cout< } p=p->next; } } // void dirs(dirNode *p,char str[]) { char newstr[100]; dirNode *q; cout< dir(p); q=p; if(q->sub){ strcpy(newstr,""); strcat(newstr,str); strcat(newstr,"\\"); strcat(newstr,q->name); dirs(q->sub,newstr); } q=p; while(q->next){ if(q->next->sub){ strcpy(newstr,""); strcat(newstr,str); strcat(newstr," \\"); strcat(newstr,q->next->name); dirs(q->next->sub,newstr); } q=q->next; } } // 顯示所有目錄 void LSALL() { dirNode *p; cout<<"顯示所有目錄結構"< p=root.sub; dirs(p,"root"); [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]
From:http://tw.wingwit.com/Article/program/czxt/201311/24002.html