Text compression in c program | computer graphics lab

Text compression is mainly used for reduce the file size. Text compression process Encoding information’s using fewer bits than an unencoded representation. Coding Is not completed successfully. For Source coding Refer CLICK LINK -2
#include<stdio.h>
#include<conio.h>
#include<string.h>

int count=0,i,j,flag=0;
char n1[20],n2[20],ch,chh,a=':';
FILE *f1,*f2;
void enc()
{
while(!feof(f1))
{
fscanf(f1,"%s",n1); TEXT COMPRESSION SOURCE CODING
for(i=0;i<=strlen(n1);i++) { ch=n1[i]; chh=n1[i+1]; if(ch==chh) count++; else { count++; fprintf(f2,"%c%d",ch,count); printf("%c%d",ch,count); getch(); count=0; } } fprintf(f2,"%c",a); printf("%c",a); } fclose(f1); fclose(f2); } void dec() { FILE *f; f=fopen("o.txt","r"); while(!feof(f)) { fscanf(f,"%c %d",&ch,&count); if(ch==':') { printf("\n"); continue; } for(i=0;i


OUTPUT
INPUT FILE:

bb.txt:
o.txt:
c1o2l1
OUTPUT:
Uncompressed File
c1o2l1
Decompressed File
Udhaya

Actual word:cool

Post a Comment

0 Comments