【发布时间】:2011-12-18 01:11:44
【问题描述】:
我正在阅读存档文件。在 unix 中使用ar 命令创建的存档文件。当我放置文件时,它会这样说
!<arch>
correct.c/ 1319871022 1000 1000 100664 0 `
hello.c/ 1319871007 1000 1000 100664 0 `
hi.c/ 1319870999 1000 1000 100664 0 `
make.c/ 1319871028 1000 1000 100664 0 `
pie.c/ 1319871015 1000 1000 100664 0 `
three.c/ 1319871035 1000 1000 100664 0 `
我想展示的只是
correct.c
hello.c
hi.c
make.c
pie.c
three.c
这是关于这部分的代码。 archive_name 是文件名。 filestr 是字符串,也可以容纳 30 个 chars 并且文件是 FILE *file 但它在上面声明。
file = fopen(archive_name, "r");
if(file == NULL) perror("\nError opening file\n");
else {
while( fgets(filestr, 10, file) != NULL )
printf("%s", filestr);
fclose(file);
任何帮助将不胜感激。
【问题讨论】:
-
存档中有
correct.c/、hello.c/等内容吗?还是它们是程序打开的实际文件?我以前从未遇到过ar或这些类型的档案。 -
你好,存档的内容