From: Franz Bachler on 4 Jun 2010 03:20 Hello all, I would like to get a working C-Code-Example which compress a file with the huffman algorythm. huffman inputfile.txt outputfile.txt Greetings, Franz -- Franz Bachler A-3250 Wieselburg E-Mail: fraba (at) gmx.at Homepage: http://members.aon.at/fraba oder http://home.pages.at/fraba
From: Franz Bachler on 4 Jun 2010 09:27 > I would like to get a working C-Code-Example which compress a file with > the huffman algorythm. > > huffman inputfile.txt outputfile.txt http://www.codeproject.com/KB/files/huffman.aspx This works fine and is fast. But if you recompress the compressed file again you save approx. 7 % space.
From: Franz Bachler on 16 Jun 2010 10:00 Hello again, >> I would like to get a working C-Code-Example which compress a file with >> the huffman algorythm. >> huffman inputfile.txt outputfile.txt > > http://www.codeproject.com/KB/files/huffman.aspx > > This works fine and is fast. But if you compile with the compiler e.g. Borland C++ 5.5.1 and with Microsoft Visual Studio or DJGPP then you can't decode a compressed file encoded with the program from a different compiler. The reason is qsort(); the different compilers produces different results. replace qsort with your own (e.g. bubble) sort routine: qsort((void *)temptree, 256, sizeof(hufftree), &compare); bubblesort(temptree, 256); void bubblesort(hufftree t[], int len) { int i,j; hufftree temp; for (i=0; i<len-1; i++) { for (j=0; j<len-i-1; j++) { if (t[j].freq<t[j+1].freq) { temp = t[j]; t[j] = t[j+1]; t[j+1] = temp; } } } } Greetings, Franz
|
Pages: 1 Prev: gtk+ and Borland C++ 5.5.1 Next: Correct code to get CPU usage |