一个快进浏览文件的小程序
#include <stdio.h>
#include <dir.h>
#include <dos.h>
FILE *p;
struct ffblk w;
int a,n,i;
char m,lj;
main(int x,char *y)
{
clrscr();
if (y==0) {
textcolor(12);
exit(1);
}
lj=y;
lj=y;
if(x==1) getch();
a=findfirst(y,&w,FA_DIREC);
n=0;
while(!a) {
if (!(w.ff_name=='.'|| w.ff_attrib==16)) {
for(i=0;i<13;i++) m=w.ff_name;
n=n+1;
}
a=findnext(&w);
}
m=0;
n=0;
while(m!=0) {
textcolor(14);
printf("\n***序号:%d***文件名:%s\n",n+1,m);
textcolor(2);
xs(m,y);
printf("\n确认删除文件:%s 吗?, D--删除",m);
if (getche()=='d') remove(m);
n++;
}
}
xs(char *mm,char *y)
{
FILE *p;
char xd;
int ew;
int r;
if ((p=fopen(mm,"r"))!=NULL) {
if (y==0) ew=200;
else ew=atoi(y);
for(r=0;r<ew;r++) {
xd=fgetc(p);
putchar(xd);
}
}
fclose(p);
}