Скачиваний:
144
Добавлен:
16.04.2013
Размер:
681 б
Скачать
#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);

   while( !eof(f1) )
   {
      read(f1, str, 1);
      code(str, key);
      printf("%s",str);
   }

   close(f1);

   printf("\nFinished\n");

   getch();
}
Соседние файлы в папке lab4