zoukankan      html  css  js  c++  java
  • c语言复制文件程序

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #define SIZE 1024*1024*10
    
    int main()
    {
    	FILE *fp_read, *fp_write;
    	fp_read = fopen("E:\CentOS-6.5\CentOS-6.5-i386-bin-DVD1.iso","rb");
    	fp_write = fopen("D:\CentOS-6.5-i386-bin-DVD1.iso","wb");
    	char *buf;
    	int read_n, write_n;
    	buf = (char*)calloc(1,SIZE);
    	if (fp_read == NULL || fp_write == NULL){
    		perror("File open fail.
    ");
    	}
    	printf("開始拷贝 %s:
    ","pycharm-professional-3.1.3.exe");
    	while (memset(buf, 0, SIZE), (read_n = fread(buf, 1, SIZE, fp_read)) > 0){
    		write_n = fwrite(buf, 1, read_n, fp_write);
    		if (write_n != read_n){
    			printf("write error
    ");
    			system("pause");
    			exit(-1);
    		}
    	}
    	printf("%s 拷贝成功.
    ","pycharm-professional-3.1.3.exe");
    	fclose(fp_read);
    	fclose(fp_write);
    }
    
    

  • 相关阅读:
    css
    page
    Process Array
    multiprocessing
    page
    mid
    防御 CSRF
    django 常用过滤器
    template
    Android学习笔记28-对话框Dialog控件的使用
  • 原文地址:https://www.cnblogs.com/ldxsuanfa/p/10014653.html
Copyright © 2011-2022 走看看