-
Notifications
You must be signed in to change notification settings - Fork 0
/
decompression4.c,v
78 lines (69 loc) · 1.57 KB
/
decompression4.c,v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
head 1.1;
access;
symbols;
locks
root:1.1; strict;
comment @ * @;
1.1
date 2017.11.13.17.04.34; author root; state Exp;
branches;
next ;
desc
@this is 4-bit decompression file
@
1.1
log
@Initial revision
@
text
@// this is decompression ofi 4 byte
#include"header.h"
#include"prototype.h"
int decompression4()
{
printf("in function----->%s\n",__func__);
unsigned char *buff=NULL,ch,c,d;
unsigned int efd,fd2,fd3,i=0,count,count1,length,j,n,r;
efd=open("compression",O_RDONLY);
printf("efd is : %d\n",efd);
count=lseek(efd,0,SEEK_END);
printf("count is : %d\n",count);
buff=(char*)malloc(sizeof(char)*(count));
lseek(efd,0,SEEK_SET);
count1=read(efd,buff,(count));
printf("master array is : %s\n and count1: %d\n",buff,count1);
fd2=open("encrypted_file",O_RDONLY);
if(fd2!=0)
printf("ENCRYPTED FILE IS OPENED\n");
fd3=open("compressed_file",O_RDWR);
if(fd3!=0)
{
printf("main file is opened\n");
}
length=lseek(fd2,0,SEEK_END);
printf("the total characters in actuall file------>%d \n",length);
lseek(fd2,0,SEEK_SET);
for(i=0;i<=(length-1);i++)
{
r =read(fd2,&ch,1);
if(r!=1)
printf("character is not read......oops!!\n");
c = ch;
d = ch;
c = c >> 4;
d = d << 4;
d = d >> 4;
printf("the locationn is ------>%d\n",c);
write(fd3,(buff+c),1);
printf("the written charracter is %c\n",*(buff+c));
// sprintf(&n,"%d",d);
printf("the location is -------->%d\n",d);
write(fd3,(buff+d),1);
printf("the written character is %c\n",*(buff+d));
}
close(fd2);
close(fd3);
close(efd);
return 0;
}
@