基本段错误
struct dir_copy path ; sprintf(path.srcdir_path,"%s/%s",src_path,dir->d_name); sprintf(path.destdir_path,"%s/%s",root_dir,path.srcdir_path); printf("file = %s\n",path.srcdir_path); printf("file = %s\n",path.destdir_path); struct dir_copy* path = (struct dir_copy*)malloc(sizeof(struct dir_copy)); //不能用struct dir_copy* path; //否则会报段错误 sprintf(path->srcdir_path,"%s/%s",src_path,dir->d_name); sprintf(path->destdir_path,"%s/%s",root_dir,path->srcdir_path); printf("file = %s\n",path->srcdir_path); printf("file = %s\n",path->destdir_path);