磁盘文件系统类型:ext2 ext3 ext4
深度优先遍历目录
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <dirent.h>
#include <strings.h>
void printdir(char* pathname,int width){
DIR* dir=opendir(pathname); //首先打开路径
if(NULL==dir){
perror("opendir");
return;
}
struct dirent *p;
char buf[512];
while((p=readdir(dir))!=NULL){ //读目录中的每个文件
if(!strcmp(p->d_name,".") || !strcmp(p->d_name,"..")){
continue;
}