|
楼主 |
发表于 2003-3-11 21:22:26
|
显示全部楼层
暂时存放
[code:1]
#define R 54
#include <stdio.h>
main()
{
FILE *afmp;
char asdls[1000000];
char cmd[8];
char line[1000];
char path[1000];
int page=0,pgmx,npp;
int i1,i2,i3,i4;
char import[1000]="/tarenauser/typhoon";
page=0; npp=5;
for(i4=0;import[i4]!=0;i4++);
path[i4]=import[i4];
//scanf("%s",path);
sprintf(cmd,"ls -AlF %s",path);
afmp=popen(cmd,"r");
if(!afmp)
{
printf("error!\n");
exit(1);
}
for(i1=0;i1<1000000;i1++)
asdls[i1]=0;
i1=0;i3=0;//TOTAL行标记
while(fgets(line,sizeof(line),afmp))
{
if(i3!=0)//丢弃“TOTAL行”
{
for(i2=R;line[i2]!='\n';i2++)
{
if(line[i2]==' ')
{
line[i2]='\"';
break;
}
}
for(i2=i2;line[i2]!='\n';i2++)
{
if(line[i2]=='>')
if(line[i2-2]==' '&&line[i2-1]=='-'&&line[i2+1]==' ')
{
line[i2-2]=line[i2+1]='\"';
break;
}
i2++;
}
printf("%s",line);
//for(i2=0;line[i2]!='\n';i2++)
//{
// asdls[i1]=line[i2];
// i1++;
//}
//asdls[i1]='\"';i1++;
//asdls[i1]='\n';i1++;
}
i3=1;
}
//printf("%s",asdls);
pclose(afmp);
}
[/code:1] |
|