Скачиваний:
144
Добавлен:
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 Кб125LAB4.EXE
  • #
    16.04.201314.49 Кб124LAB4.OBJ
  • #
    16.04.2013732 б154LAB41.CPP
  • #
    16.04.201329.1 Кб124LAB41.EXE
  • #
    16.04.201313.6 Кб126LAB41.OBJ
  • #
    16.04.2013723 б144LAB42.CPP
  • #
    16.04.201326.63 Кб124LAB42.EXE
  • #
    16.04.2013681 б144LAB43.CPP
  • #
    16.04.201326.56 Кб124LAB43.EXE
  • #
    16.04.201356.34 Кб148README
  • #
    16.04.20134.22 Кб125README.COM