Text Compression program using fopen function it will open the particular file from the source. In the first file it will read the file then in the output file using w option it will perform the write option into the file. using these text compression it will reduce the size of the file
Source code Text compression in C language programming
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int i=0,j=0,count=0;
char ch, str[32000];
FILE *f1,*f2;
clrscr();
f1=fopen("D:\INPUT.TXT","r");
while((str[i]=getc(f1))!=EOF)
{
printf("%c",str[i]);
i++;
}
getch();
printf("\n");
f2=fopen("D:\OUTPUT.TXT","w");
fclose(f2);
while(j<=i)
{
ch=str[j];
while(ch==str[j]&&j<=i)
{
count++;
j++;
}
f2=fopen("D:\OUTPUT.TXT","a");
printf("\n%c%d",ch,count);
fprintf(f2,"%c%d",ch,count);
fclose(f2);
count=0;
j++;
}
fclose(f1);
getch();
}
Thursday, May 27, 2010
Text Compression CS1355 Graphics and Multimedia Lap
Subscribe to:
Post Comments (Atom)
Labels
3D-2D Translation
Algorithms
Batch Programming
C language
C world
C++
DBMS
Ebook
Games
JAVA
Java Programs
JNTU MATERIALS
JNTU PREVIOUS QUESTION PAPERS
JNTU SYLLABUS BOOKS
LAB MANUALS
Linux
Mobile softwares
Networking
Online Programs
PC TIPS
Software Diagrams
Software Engineering
Softwares
System Software
Visual Basic
0 comments:
Post a Comment