EmbLogic's Blog

compression of data

given below is just a program to fetch data from a file
with datat:
“she sells sea shells on the sea shore”

the problem is i need to fetch the characters from the sentence
one by on in a manner that each char is fetched only once :

#include
#include
#include
#include

int main()
{
int fd,i,j;
char ch;
int ma[100];
fd=open(“file.txt”,O_RDONLY);
for(i=0;i<=37;i++)
{
read(fd,&ch,1);
ma[i]=ch;
}

for(j=0;j<37;j++)
printf("%d %c\n",ma[j],ma[j]);

return 0;
}

can anyone help

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>