Курсовая работа: Сжатие данных методами Хафмана и Шеннона-Фано
AssignFile(FileToRead,MainFile.Name);
AssignFile(FileToWrite,MainFile.ArcName);
Try
Reset(FileToRead,1);
Rewrite(FileToWrite,1);
For i:=0 to 255 Do ArrOfStr[i]:='';
For i:=0 to MainFile.Stat.CountByte do
Begin
ArrOfStr[MainFile.Stat.massiv[i]^.Symbol]:=
MainFile.Stat.massiv[i]^.CodWord;
Application.ProcessMessages;
End;
CountBuf:=MainFile.Size div Count;
LastBuf:=MainFile.Size mod Count;
Buffer:='';
/////////////
CreateHead;
/////////////
for i:=1 to countbuf do
Begin
BlockRead(FileToRead,buf,Count);
//////////////////////
For j:=1 to count do
Begin
buffer:=buffer+ArrOfStr[buf[j]];
If Length(buffer)>8*count
Then
WriteInFile(buffer);
Application.ProcessMessages;