C语言实现Huffman的编码和解码( 四 )

<= total; ++index) {pNode node = nodelist[index];Byte byte = (Byte)node->data;fwrite(&byte, sizeof(byte), 1, output);fwrite(&node->weight, sizeof(node->weight), 1, output);}/*返回写入的文件头总字节数*/return (total * 5 + 1 + 2);}/*读取文件头信息(读取字符权重集)*/void readFileHeader(FILE* input, int times[]) {Byte total;int index;/*跳过文件头*/fseek(input, 2, SEEK_CUR);fread(&total, sizeof(total), 1, input);for (index = 0; index <= total; ++index) {Byte byte;int weight;fread(&byte, sizeof(byte), 1, input);fread(&weight, sizeof(weight), 1, input);times[byte] = weight;}}