存储数组 C

来源:百度知道 编辑:UC知道 时间:2024/07/02 19:37:12
我想把Linux command ls 生成的所有file infomation 放到一个数组里 请问要怎么作阿?
drwxr-xr-x 2 a1178191 students 1024 Sep 2 14:54 Link
-rw-r--r-- 1 a1178191 students 7238 Sep 2 20:50 ls3.c
-rw-r--r-- 1 a1178191 students 7225 Sep 2 20:49 ls3.c~
-rwxr-xr-x 1 a1178191 students 8767 Sep 2 20:50 ls3.ln
-rw-r--r-- 1 a1178191 students 32 Sep 1 17:50 MakeFile~
-rw-r--r-- 1 a1178191 students 35 Sep 1 17:51 Makefile
-rw------- 1 a1178191 students 28 Sep 2 14:55 x
-rw------- 1 a1178191 students 28 Sep 2 14:55 xlink-> x
-rw------- 1 a1178191 students 0 Sep 2 14:53 x~-> x

只能放结构体吧..这里的数据类型不只一种

重定向到某个文件,然后从文件读取。

先通过重定向保存到一个文件中,然后可以通过一个程序通过文件流来一一放到一个数组中啊(但最好是放在一个动态链表中,因为数组不可以改变大小)