-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
60 lines (46 loc) · 1020 Bytes
/
main.cpp
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
#include<iostream>
#include<fstream>
//#include "rle.h"
//#include "huffman.h"
//#include "LZ78.h"
#include "LZ77.h"
using namespace std;
string readTextFile(){
ifstream inFile;
string line;
char addr[100];
cout<<"\nEnter File Address : ";
gets(addr);
inFile.open(addr);
while(inFile){
getline(inFile, line);
}
inFile.close();
return line;
}
void writeTextFile(string text){
ofstream file;
char fileName[100];
cout<<"\nEnter file address : ";
gets(fileName);
file.open(fileName);
file<<text;
file.close();
}
int on_extract_entry(const char *filename, void *arg) {
static int i = 0;
int n = *(int *)arg;
printf("Extracted: %s (%d of %d)\n", filename, ++i, n);
return 0;
}
int main() {
string text;
text=readTextFile();
cout<<"Original String : "<<text<<endl;
//class call code here...
LZ77 lz77(text,1);
lz77.encode();
cout<<"\nDecoded string:"<<endl;
lz77.decode();
return 0;
}