Добавил:
korayakov
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лупин / Лабы.МП.-.5.семестр.Операционные.Системы.2007 / Лабы / lab4 / LAB42
.CPP#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