⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 showdiry.c

📁 关于传真解调的标准C源程序
💻 C
字号:
#include "stdio.h"
//#include "graphics.h"
#include "conio.h"
//#include "alloc.h"
//#include "dir.h"
//#include "mem.h"
#include "dos.h"
#include "string.h"
#include "stdlib.h"
#include "io.h"
#include "fcntl.h"
#include "process.h"
#include "stdlib.h"
#define SIZE2 20000
#define SIZE3 20000


extern int y,x;
extern char *Str,*Str1,*Str2,*Str3,*Str4;
extern int manend,man;
extern int buffin1,buffin,buffout;
extern int whw,whw1;
extern unsigned char ch;
extern unsigned char BUFFER2[SIZE2];
extern unsigned char BUFFER3[SIZE3];
extern FILE *fp2;

int A=0;
int LIST_WINDOW_DY=12;
int ki;
int dy=12;

//exter "C"
char far *vedio=MK_FP(0X0500,0X0000);
char *filespec="d:\\jin\\turc\\*.d99";
int i1=1;
int i2=1;
int k;
int filecount;
char **list;
char **list1;

int show_item1();


void showdiry()
{
     void lieb();
     void list_show();
}
/*******************************************************/
void list_show()
{
   void chuj();
   while(1)
   {
	int key3;
kais:   if(manend==1)
	{
	   void file();
	   if(man==1)
           {
              for(buffin1=0;buffin1<SIZE2;buffin1++)
              {
                 ch=BUFFER2[buffin1];
                 fwrite(&ch,1,1,fp2);
              }
              for(buffin1=0;buffin1<buffin;buffin1++)
              {
		  ch=BUFFER3[buffin1];
                  fwrite(&ch,1,1,fp2);
              }
           }
           if(man==0)
           {
              for(buffin1=0;buffin1<buffin;buffin1++)
              {
                  ch=BUFFER2[buffin1];
                  fwrite(&ch,1,1,fp2);
              }
           }
	   fclose(fp2);
	   void peizhhdlc();
           whw=whw1=man=0;
           buffin=buffout=buffin1=0;
           manend=0;
	}
	while(void bioskey(1))
	{
	   key3=0;
	   extern "C" key3=specialkey();
	   if(key3==80)
	   {
	     if(filecount>25)
	     {
	       i1++;
	       if(i1>25)
	       {
		 if(A>filecount-26&&i1>=25)
		 {
		    A=filecount-25;
		    i1=25;
		    goto kais;
		 }
		 else
		 {
		    A++;
		    setfillstyle(1,3);
		    setcolor(0);
		    DrawButton(220,141,420,450,0,7,3,7);
		    rectangle(221,141,419,449);
		    for(ki=A;ki<A+25;ki++)
		    {
		      show_item(ki,11);
		    }
		    for(i2=A+1;i2<26+A;i2++)
		    {
		       show_item1(i2,11);
		    }
		    setfillstyle(1,9);
		    setcolor(1);
		    bar(222,144+dy*24,418,144+dy*25);
		    show_item(24+A,15);
		    i1=25;
		    i2=25+A;
		    show_item1(25+A,15);
		}
	     }
	     else
	     {
		       setfillstyle(1,3);
		       setcolor(0);
		       DrawButton(220,141,420,450,0,7,3,7);
		       rectangle(221,141,419,449);
		       for(ki=A;ki<25+A;ki++)
		       {
			  show_item(ki,11);
		       }
		       for(i2=A+1;i2<26+A;i2++)
		       {
			  show_item1(i2,11);
		       }
		       setfillstyle(1,9);
		       setcolor(1);
		       bar(222,144+dy*(i1-1),418,144+dy*i1);
		       show_item(i1+A-1,15);
		       i2=i1+A;
		       show_item1(i2,15);
	       }
	    }
	    else
	    {
	       i1++;
	       if(i1>filecount) {i1=filecount;}
	       else
	       {
		  setfillstyle(1,3);
		  setcolor(0);
		  DrawButton(220,141,420,450,0,7,3,7);
		  rectangle(221,141,419,449);
		  for(ki=0;ki<filecount;ki++)
		  {
		     show_item(ki,11);
		  }
		  for(i2=1;i2<filecount+1;i2++)
		  {
		     show_item1(i2,11);
		  }
		  setfillstyle(1,9);
		  setcolor(1);
		  bar(222,144+dy*(i1-1),418,144+dy*i1);
		  show_item(i1+A-1,15);
		  i2=i1;
		  show_item1(i2,15);
	       }
	    }
	 }
	 if(key3==27) void key27();
	 if(key3==13) void key13();
	 if(key3==72) void key72();
	 if(key3==81) void key81();
	 if(key3==73) void key73();
      }
   }
}
/****************************************************************/
chuj()
{
     DrawButton(220,141,420,450,0,7,3,7);
     if(filecount>=25)
     {
	for(ki=0;ki<25;ki++)
	{
	   show_item(ki,11);
	}
	for(i2=1;i2<26;i2++)
	{
	   show_item1(i2,11);
	}
	setfillstyle(1,9);
	setcolor(1);
	bar(221,144,419,144+dy);
	show_item(0,15);
	i2=1;
	show_item1(i1,15);
     }
     else
     {
	for(ki=0;ki<filecount;ki++)
	{
	   show_item(ki,11);
	}
	for(i2=1;i2<filecount+1;i2++)
	{
	   show_item1(i2,11);
	}
        setfillstyle(1,9);
	setcolor(1);
	bar(221,144,419,144+dy);
	show_item(0,15);
	i2=1;
	show_item1(i1,15);
     }
}
/****************************************************************/
key27()
{
	 int i,kk;
	 A=0;
	 i1=1;
	 i2=1;
	 for(kk=0;kk<filecount;kk++)
	 {
	    if(list[kk]!=NULL)
	    {
		free(list[kk]);
	    }
	 }
	 for(kk=0;kk<filecount;kk++)
	 {
	    if(list1[kk]!=NULL)
	    {
		free(list1[kk]);
	    }
	 }
	 free(list);
	 free(list1);
	 void loadscr("fname");
	 DrawButton(220,100,420,140,0,BLACK,BLUE,BLACK);
	 PutCC16(250,110,20,WHITE,Str2);
	 x=1;
	 y=220;
	 void jian1();
}
/************************************************************/
key13()
{
	int k,kk;
	int status;
	for(k=0;k<12;k++)
	vedio[k]=list[i1-1][k];
	for(kk=0;kk<filecount;kk++)
	{
	   if(list[kk]!=NULL)
	   {
	      free(list[kk]);
	   }
	}
	for(kk=0;kk<filecount;kk++)
	{
	   if(list1[kk]!=NULL)
	   {
	      free(list1[kk]);
	   }
	}
        free(list);
	free(list1);
	void closegraph();
	status=spawnl(P_WAIT,"ym4.exe",NULL);
	if(status==-1)
	{
	   printf("error in spawnl");
	   exit(1);
	}
	void InitGra();
	void loadscr("fname");
	DrawButton(220,100,420,140,0,BLACK,BLUE,BLACK);
	PutCC16(250,110,20,WHITE,Str2);
	A=0;
	i1=i2=1;
	x=1;
	y=220;
	void jian1();
}

/***************************************************************/
void key72()
{
    if(filecount>25)
    {
       if(i1>1)
       {
	  i1--;
	  setfillstyle(1,3);
          setcolor(0);
      DrawButton(220,141,420,450,0,7,3,7);
	  rectangle(221,141,419,449);
	  for(ki=A;ki<A+25;ki++)
	  {
	   show_item(ki,11);
	  }
	  for(i2=A+1;i2<A+26;i2++)
	  {
	   show_item1(i2,11);
	  }
	  setfillstyle(1,9);
          setcolor(1);
	  bar(222,144+dy*(i1-1),418,144+dy*(i1));
	  show_item(i1-1+A,15);
	  i2=i1+A;
	  show_item1(i2,15);
       }
       else
       {
	  if(A!=0)
	  {
	     A--;
	     i1=1;
	     setfillstyle(1,3);
	     setcolor(0);
         DrawButton(220,141,420,450,0,7,3,7);
	     rectangle(221,141,419,449);
	     for(ki=A;ki<A+25;ki++)
	     {
		show_item(ki,11);
	     }
	     for(i2=A+1;i2<26+A;i2++)
	     {
		show_item1(i2,11);
	     }
	     setfillstyle(1,9);
	     setcolor(1);
	     bar(221,144,419,144+dy);
	     show_item(i1-1+A,15);
	     i2=i1+A;
	     show_item1(i2,15);
	  }
	  else{}
       }
   }
   else
   {
       if(i1>1)
       {
	  i1--;
	  setfillstyle(1,3);
          setcolor(0);
      DrawButton(220,141,420,450,0,7,3,7);
	  rectangle(221,141,419,449);
	  for(ki=0;ki<filecount;ki++)
	  {
	   show_item(ki,11);
	  }
	  for(i2=1;i2<filecount+1;i2++)
	  {
	   show_item1(i2,11);
	  }
	  setfillstyle(1,9);
          setcolor(1);
	  bar(222,144+dy*(i1-1),418,144+dy*(i1));
	  show_item(i1-1,15);
	  i2=i1;
	  show_item1(i2,15);
       }
       else{}
   }
}

/***************************************************************/
void key81()
{
       if(filecount>25)
       {
	    A++;
	    if(A<((filecount/25)-1)*25)
	    {
		 A=A+24;
		 if(A>filecount-25)
		 {
		    A=A-24;
		    goto zhench;
		 }
		 else
		 {
		    setfillstyle(1,3);
		    setcolor(0);
            DrawButton(220,141,420,450,0,7,3,7);
		    rectangle(221,141,419,449);
		    for(ki=A;ki<A+25;ki++)
		    {
		       show_item(ki,11);
		    }
		    for(i2=A+1;i2<26+A;i2++)
		    {
		       show_item1(i2,11);
		    }
		    setfillstyle(1,9);
		    setcolor(1);
		    bar(221,144+dy*(i1-1),419,144+dy*i1);
		    show_item(i1+A-1,15);
		    i2=i1+A;
		    show_item1(i2,15);
		 }
	    }
	    else
	    {
zhench:	            A=filecount-25;
		    setfillstyle(1,3);
		    setcolor(0);
            DrawButton(220,141,420,450,0,7,3,7);
		    rectangle(221,141,419,449);
		    for(ki=A;ki<A+25;ki++)
		    {
		       show_item(ki,11);
		    }
		    for(i2=A+1;i2<A+26;i2++)
		    {
		       show_item1(i2,11);
		    }
		    setfillstyle(1,9);
		    setcolor(1);
		    bar(221,144+dy*(i1-1),419,144+dy*i1);
		    show_item(A+i1-1,15);
		    i2=A+i1;
		    show_item1(i2,15);
		    A=filecount-25;

	     }
       }
       else{}
}

/**************************************************************/
void key73()
{
	    if(filecount>25)
	    {
		 A--;
		 if(A<=24)
		 {
		   A=0;
		   setfillstyle(1,3);
		   setcolor(0);
           DrawButton(220,141,420,450,0,7,3,7);
		   rectangle(221,141,419,449);
		   for(ki=A;ki<A+25;ki++)
		   {
		      show_item(ki,11);
		   }
		   for(i2=A+1;i2<A+26;i2++)
		   {
		      show_item1(i2,11);
		   }
		   setfillstyle(1,9);
		   setcolor(1);
		   bar(221,144+dy*(i1-1),419,144+dy*i1);
		   show_item(i1+A-1,15);
		   i2=A+i1;
		   show_item1(i2,15);
		   A=0;
		 }
		 else
		 {
		    A=A-24;
		    setfillstyle(1,3);
		    setcolor(0);
            DrawButton(220,141,420,450,0,7,3,7);
		    rectangle(221,141,419,449);
		    for(ki=A;ki<A+25;ki++)
		    {
		       show_item(ki,11);
		    }
		    for(i2=A+1;i2<A+26;i2++)
		    {
		       show_item1(i2,11);
		    }
		    setfillstyle(1,9);
		    setcolor(1);
		    bar(221,144+dy*(i1-1),419,144+dy*i1);
		    show_item(A+i1-1,15);
		    i2=i1+A;
		    show_item1(i2,15);
		 }
	    }
	    else{}
}
/***************************************************************/
  void show_item(int nth,int color)
  {
     char buf[10];
     setcolor(color);
     outtextxy(270,148+(LIST_WINDOW_DY)*(nth-A),list[nth]);
     outtextxy(388,148+(LIST_WINDOW_DY)*(nth-A),list1[nth]);
     sprintf(buf,"K");
     outtextxy(408,148+(LIST_WINDOW_DY)*(nth-A),buf);
   }
   void show_item1(int kth,int color)
   {
       char n[10];
       setcolor(color);
       if(A==0)
       {
	    sprintf(n,"%d",i2);
	    outtextxy(230,148+dy*(kth-1),n);
       }
       else
       {
	 sprintf(n,"%d",i2);
	 outtextxy(230,148+dy*(kth-A-1),n);
       }
    }
/********************************************************************/
   void file_count(char *filespec)
   {
      int done;
      int count=0;
      struct ffblk DTA;
      done=findfirst(filespec,&DTA,0);
      if(!done) count++;
      while(!done)
      {
	 done=findnext(&DTA);
	 if(!done)
	 {
	     if(DTA.ff_fsize>0)
	     count++;
	 }
      }
      return(count); /*count是符合条件的个数*/
    }

lieb()
{
    int ki1,j,number,done;
    struct ffblk DTA;

    filecount=file_count(filespec);  /*符合条件的个数*/
    list=(char **)malloc((filecount+1)*sizeof(char*));
    if(list==NULL)
    {
       printf("no memory enough");
       exit(1);
    }
    list1=(char **)malloc((filecount+1)*sizeof(char*));
    if(list1==NULL)
    {
	printf("no enough memory");
	exit(1);
    }
    for(ki1=0;ki1<=filecount;ki1++)
    {
       list[ki1]=NULL;
       list1[ki1]=NULL;
    }
    done=findfirst(filespec,&DTA,0);
    ki1=0;
    while(!done)
    {
       if(ki1==filecount) break;
       list[ki1]=malloc(15*sizeof(char));
       if(list[ki1]!=NULL)
       {
	  if(DTA.ff_fsize!=0)
	  {
	     sprintf(list[ki1],"%s",DTA.ff_name);
             ki1++;
	  }
	  done=findnext(&DTA);
       }
       else return(1);
    }
    done=findfirst(filespec,&DTA,0);
    ki1=0;
    while(!done)
    {
       list1[ki1]=malloc(5*sizeof(char));
       if(list1[ki1]!=NULL)
       {
	  if(DTA.ff_fsize!=0)
	  {
	     sprintf(list1[ki1],"%ld",DTA.ff_fsize/1000);
             ki1++;
	  }
	  done=findnext(&DTA);
       }
       else return(1);
     }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -