我想写一个代码,将例如这个文本转换为:“aaaaaaabbbb”转换为:“a7b4”。 它应该从一个文件读取并写入另一个文件。这里是代码的错误部分,我不能让它工作。泰为帮助..在C中的RLE文本压缩
fread(&fx,sizeof(fx),1, fin); // read first character
while(!feof(fin))
{
fread(&z, sizeof(z),1, fin); //read next characters
if(z!=fx) { fputs(fx, fout);
fputs(poc, fout);
poc=1; // if its different count=1
fx=z; // and z is new character to compare to
}
else poc++;
}
fputs(fx, fout);
fputs(poc, fout);