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

📄 install.bak

📁 该包是数据结构的实验软件,来源于合肥工业大学人工智能与数据挖掘实验室,用来实现数据结构.
💻 BAK
字号:
#include <stdio.h>
#include <conio.h>
#include <process.h>
#include <dir.h>

#include <sys\stat.h>
#include <string.h>
#include <fcntl.h>
#include <io.h>
#include <string.h>
#include <stdlib.h>

#include <dos.h>




copy1(char s1[],char s2[])
{
const int size=4096;
int fdr,fdw;
char buf[size];

int  bytes;



if ((fdr=open(s1, O_RDONLY )) == -1)
   {
      printf("Error Opening File\n");
      exit(1);
   }



if ((fdw =creat(s2, O_WRONLY )) == -1)
   {
      printf("Error Opening File\n");
      exit(1);
   }


while( (bytes = read(fdr, buf, size) )>0 )
      write(fdw,buf,bytes);


close(fdr);
close(fdw);
return 0;
}

void copy(char st1[],char st2[])
{
struct find_t ffblk;
  int done;
  char drive1[_MAX_DRIVE];
  char dir1[_MAX_DIR];
  char file1[_MAX_FNAME];
  char ext1[_MAX_EXT];

  char drive2[_MAX_DRIVE];
  char dir2[_MAX_DIR];
  char file2[_MAX_FNAME];
  char ext2[_MAX_EXT];



  _splitpath(st1,drive1,dir1,file1,ext1);
  _splitpath(st2,drive2,dir2,file2,ext2);
   puts(st1);
  puts(drive1);
  puts(dir1);
  puts(file1);
  puts(ext1);

  puts(st2);
  puts(drive2);
  puts(dir2);
  puts(file2);
  puts(ext2);

   char ss1[50]="";
  strcpy(ss1,drive1);
  strcat(ss1,dir1);

  char ss2[50]="";
  strcpy(ss2,drive2);
  strcat(ss2,dir2);

  //printf("Directory listing of *.*\n");
  done = _dos_findfirst(st1,_A_NORMAL,&ffblk);
  while (!done)
  {
    printf("  %s\n", ffblk.name);
    strcat(ss1,ffblk.name);
    strcat(ss2,ffblk.name);
    copy1(ss1,ss2);
    done = _dos_findnext(&ffblk);
  }


}

int main(void)
{
 char s1[]="D:\\tc\\bin\\*.cpp";
 char s2[]="D:\\tc\\yj\\*.*";

 copy(s1,s2);
 return 0;
 /*  int stat;

   stat = mkdir(DIRNAME);
   if (!stat)
	  printf("Directory created\n");
   else
   {
      printf("Unable to create directory\n");
      exit(1);
   }

   getch();
  */
  /* char buffer[MAXPATH];

getcwd(buffer, MAXPATH);
printf("The current directory is: %s\n", buffer);
*/


//system("rd DIRNAME ");

}

⌨️ 快捷键说明

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