Скачиваний:
148
Добавлен:
16.04.2013
Размер:
723 б
Скачать
#include "stdio.h"
#include "conio.h"
#include "stdlib.h"
#include "process.h"
#include "dos.h"
#include "graphics.h"
#include "iostream.h"
#include "io.h"
#include "string.h"
#include <fcntl.h>

void code (char* str, short key)
{
   for( int i = 0; i < strlen(str); i++)
      str[i] = str[i] ^ key;
}

void main()
{
   char *fn, *str;
   short key; 
   printf("Input file name: ");
   scanf("%s",fn);
   printf("Input key: ");
   scanf("%d",&key);

   int f1 = open(fn,O_RDWR);
   int f2 = open(fn,O_RDWR);

   while( !eof(f1) )
   {
      read(f1, str, 1);
      code(str, key);
      write(f2, str, 1);
   }

   close(f1);
   close(f2);

   printf("Finished");

   getch();
}
Соседние файлы в папке lab4
  • #
    16.04.201351.8 Кб129LAB4.EXE
  • #
    16.04.201314.49 Кб128LAB4.OBJ
  • #
    16.04.2013732 б158LAB41.CPP
  • #
    16.04.201329.1 Кб128LAB41.EXE
  • #
    16.04.201313.6 Кб130LAB41.OBJ
  • #
    16.04.2013723 б148LAB42.CPP
  • #
    16.04.201326.63 Кб128LAB42.EXE
  • #
    16.04.2013681 б148LAB43.CPP
  • #
    16.04.201326.56 Кб128LAB43.EXE
  • #
    16.04.201356.34 Кб152README
  • #
    16.04.20134.22 Кб129README.COM