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

📄 mhfile.c

📁 Many C samples. It is a good sample for students to learn C language.
💻 C
字号:
/* Bai tap 1_70 - Ma hoa 1 file bang phep XOR */
#include <stdio.h>

void main()
{
  char c, filein[50], fileout[50], key;
  FILE *fpin, *fpout;

  printf("\nCho biet ten tap tin nguon : ");
  gets(filein);
  printf("\nCho biet ten tap tin dich : ");
  gets(fileout);
  printf("\nCho biet khoa : ");
  scanf("%c", &key);
  if ((fpin = fopen(filein, "r")) == NULL)
    printf("Khong tim thay tap tin %s", filein);
  else
    if ((fpout = fopen(fileout, "w+")) == NULL)
    {
      printf("Khong the tao tap tin %s", fileout);
      fclose(fpin);
    }
    else
    {
      do {
        c = fgetc(fpin);
        if (c != EOF)
          fputc(c ^ key, fpout);
      } while (c != EOF);
      fclose(fpin);
      fclose(fpout);
      printf("\nCong viec hoan tat");
    }

  getch();
}

⌨️ 快捷键说明

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