Linux?????ls?????????
???????????? ???????[ 2014/10/13 10:23:02 ] ?????????????? Linux
????????ls???????????????????????????μ????????????????????????????????????????????飬?????????С??????η???????????????????????????????
????????????????????:
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <sys/stat.h>
5 #include <fcntl.h>
6 #include <unistd.h>
7 #include <dirent.h>
8 #include <sys/types.h>
9 #include <pwd.h>
10 #include <grp.h>
11 #include <time.h>
12 #define CNT 256
13 int file_name(DIR *fp?? char *path?? char name[][CNT]);
14 void str_sort(char name[][CNT]?? int cnt);
15 void mode_to_char(mode_t mode?? char *buf);
16 char *time_change(char *time);
17 void show(char name[][CNT]?? int cnt);
??????????????????????????????????????????????????????????int?????
??????????????????:
1intfile_name(DIR*fp??char*path??charname[][CNT])
2{
3intcnt=0;
4structdirent*p;
5while((p=readdir(fp))!=NULL)
6{
7if(strncmp(p->d_name??"."??1)==0||strncmp(p->d_name??".."??2)==0)
8continue;
9strcpy(name[cnt]??path);
10strcat(name[cnt]??"/");
11strcat(name[cnt]??p->d_name);
12cnt++;
13}
14closedir(fp);
15returncnt;
16}
??????????????????????????????????????????????char *buf?С?
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11