int main(void) { struct dirent **namelist; int n; const char *targetdirectory = "."; n = scandir(targetdirectory, &namelist, 0, alphasort); struct stat buf; if (n < 0) perror("scandir"); else { quick_struct(namelist, n); while (n--) { stat(namelist[n]->d_name, &buf); printf("%-23s %10ld \t %s \n", namelist[n]->d_name, buf.st_mtime, ctime(&buf.st_mtime)); free(namelist[n]); } free(namelist); } }
int main(void) { char name[30]; int i; printf("将原始数据排序\n"); quick_struct(SDatas,NUM); printf("请输入要查找人的名字:\n"); scanf("%s",name); i = BinarySeach(SDatas,name,NUM); if(i == -1) { printf("没有查找到该人信息\n"); return 0; } printf("查找结果:\n"); print_data(&SDatas[i]); return 1; }