霍夫曼编码器 [英] huffman encoder

查看:82
本文介绍了霍夫曼编码器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


这是我在同事的书中看到的程序。程序是

在turbo C ++ 3.0编译器上运行


/ *头文件的开头huff.h * /

#ifndef _HUFF_H_

#define _HUFF_H_


#include< io.h>

#include< conio.h>

#include< stdio.h>


typedef struct node

{

unsigned char c;

unsigned long int freq;

struct node * up,* left,* right;

} sn;


typedef struct ftable

{

unsigned long int freq;

} sft;


/ *全局变量* /

int buf [50],bc;

sft ft;

sn leaf [256];

sn * a,* t [256];


/ *函数原型* /


int initialize( char *);

/ *操作:初始化函数

post条件:将所有叶子初始化为空值,禁止

字符

频率指向。设置假的频率值s $>
* /

int sortnode(int);

/ *操作:排序功能

后期条件:按递减顺序对指针节点进行排序

频率* /


int getnodecount();

/ * operation:get非零频率节点的数量

后置条件:* /


int createtree();

/ *操作:创建这棵树

后期条件:创造一个非最佳的霍夫曼树

来生成前缀代码

* /


int comparenode(sn *,sn *);

/ *操作:节点比较

后置条件:如果两个指针指向同一数据则返回0
else返回-1

* /


void addtobuffer(int);

/ *操作:初始化位缓冲区

后置条件:保留每个离开节点的前缀代码

* /


void refreshbuffer(FILE *);

/ *操作:w rited编码前缀字符

发布条件:

* /

/ * void freetree(sn *); * /

char * getfilename(char *);

/ *操作:获取文件名

post condition:拆分文件路径获取文件名

* /


unsigned char getoddchar();

/ *操作:与refreshbuffer相同

前置条件:位缓冲少于8位

* /


#endif


/ *结束头文件* /


/ *

霍夫曼编码的静态版本。

它绝不是最佳的

压缩3.25 kb以上的文件

上限尚未确定高达50K OK

全局变量的使用

不完美编码

非标准功能的使用缺少垃圾收集器留下很多

如果你正在运行这个程序就可能会吃掉你的内存

old dos MACHIN es $>
* /


#include" huff.h"

int main(无效)

{

FILE * fp,* fq;

int ch,i;

char fname [100],efile [100];

unsigned long int fsize,efsize;


clrscr(); / *非标准fn * /

printf(" \ nHuffman encoder");

printf(" \ n输入输入文件的名称(将成为压缩):);

fgets(fname,100,stdin);

fname [strlen(fname)-1] = 0;


printf(" \ n输入输出文件名(压缩文件):");

fgets(efile,100,stdin);

efile [strlen(efile)-1] = 0;


if(initialize(fname)== - 1)

{

printf(\ nnError无法打开输入文件..);

返回-1;

}

printf (\\\
Initialization over.\Preparing to compress ...);

if(createtree()== - 1)

{

printf(" \\\
Memory allocation error ..");

返回-1;

}

fq = fopen(efile," wb");

if(!fq)

{

printf(" \ nError)打开输出文件..;;

fclose(fq);

返回-1;

}

fp = fopen(fname," rb");

if(!fp)

{

printf(" \ nError无法打开输入文件...");

fclose(fp);

返回-1; < br $>
}

fsize = filelength(fileno(fp)); / * non std fn * /

/ ****为(i = 0; i< 256; i ++)编写解码表* /

>
{

ft.freq = leaf [i] .freq;

fwrite(& ft.freq,sizeof(struct ftable),1,fq );

}

/ *写出表示filenamelength大小的字符* /

fputc(strlen(getfilename(fname)) + 1,fq);

/ *写入文件名* /

fwrite(getfilename(fname),strlen(getfilename(fname))+ 1,1,fq );

/ ***完成解码表的编写***** /

printf(" \\\
Compressing ...");

while(ch = fgetc(fp),ch!= EOF)

{

addtobuffer(ch);

refreshbuffer (fq);

}

fputc(getoddchar(),fq);

fputc(bc,fq);

fclose(fq);

printf(" \ nCompression complete。");

/ *****用于显示压缩摘要** ** /

fp = fopen(efile," rb");

if(!fp)

{

printf(" \ nCoul d不打开输出文件进行分析");

printf(\ n \\ n压缩摘要无法显示);

返回-1;

}

efsize = filelength(fileno(fp)); fclose(fp);

printf(" \ n\\\
Compression summary \\\
") ;

printf(" \\\
Input filesize:%lu bytes",fsize);

printf(" \\\
Output filesize:%lu",efsize);

printf(\ n压缩到原始大小的%Lf %%,((长

双倍)efsize * 100 / fsize));

返回0;

}

int sortnode(int z)/ *排序到t [z]而不是t [z-1] * /

{

int j,k;

sn * b;


for(k = 0; k< = z; k ++)

for(j =(k + 1); j< = z; j ++)

{

if ((t [k] - > freq)<(t [j] - > freq))

{

b = t [k];

t [k] = t [j];

t [j] = b;

}

}

返回0;

}


char * getfilena我(char * filepath)

{

char drive [4],dir [67],file [15],ext [5];

fnsplit(filepath,drive,dir,file,ext); //非标准fn

strcat(文件,分机);

返回文件;

}

unsigned char getoddchar()

{

int i;

for(i = bc; i< 8; i ++)

{buf [i] = 0;}

返回

((1 * buf [7])+(2 * buf [6])+(4 * buf [5])+(8 * BUF [4])+(16 * BUF [3])+(32 * BUF [2])+(64 * BUF [1])+(128 * BUF [0])) ;

}


void refreshbuffer(FILE * p)

{

int i;

unsigned char q;

while(bc> = 8)

{


q =(1 * BUF [7])+(2 * BUF [6])+(4 * BUF [5])+(8 * BUF [4])+(16 * BUF [3])+(32 * BUF [2] )+(64 * buf [1])+(128 * buf [0]);

if(fputc(q,p)!=(无符号)q || q< 0 || q> ; 255)printf(" \ nError");

for(i = 8; i< bc; i ++)

{buf [i-8] = buf [i];}

bc- = 8;

}

}


void addtobuffer (int r)

{

int i,buftv [15];

int bct = -1,buft [15];


if(r> 255 || r< 0)

{

printf(" ; \\\
Value错误...");

getch();

}

a =& leaf [r]; < (&a;> up)!= NULL)

{

/ * temp = a; * /

if(comparenode((a-> up-> left),a)== 0)

{buft [++ bct] = 0;}

else if(comparenode((a-> up-> right),a)== 0)

{buft [++ bct] = 1;}

else

{printf(" \\\
Parent Error"); / *用于调试* /}


a = a-> up;

}


for(i = 0; i< = bct; i ++)

{buftv [bct-i] = buft [i];}


for(i = 0;我< = bct; i ++)

{buf [bc + i] = buftv [i];}


bc + = bct + 1;

返回;

}

int createtree()

{

int i;

sortnode(255);

for(i = getnodecount(); i> 0; i--)

{

sortnode(i);

a = NULL;

a =(sn *)malloc(sizeof(sn));


if(!a)

{

printf(" \\\
Memory allocation error ...");

printf( \ n按任意键继续......;;

getch();

返回-1; / *内存分配错误* /

}

/ *确定值* /

a-> freq =(t [i] - > freq)+(t [i-1] - > freq);

a-> right = t [i];

a-> left = t [i-1];

a-> up = NULL;

a-> c =''\''';

t [i] - > up = a;

t [i-1] - > up = a;

t [i-1] = a;

}

返回0;

}

int initialize(char * filename)

{

int i,j;

FILE * fp;

for(i = 0; i< 256; i ++)

{

leaf [i] .c = i;

leaf [i] .freq = 0;

leaf [i] .up = NULL;

leaf [i] .left = NULL;

leaf [i] .right = NULL;

}


fp = fopen(filename," rb");

if(!fp)

{return -1 ; / *无法打开文件* /}

而(j = fgetc(fp),j!= EOF)

{

leaf [j] .freq ++;

if(j< 0 || j> 255)

{

printf(" \\ \
Error ..."); //应该在这里添加一个出口

getch();

}

}

fclose(fp) ;

for(i = 0; i< 256; i ++)

{

t [i] =& leaf [i];

if((t [i] - > up)!= NULL)

{

printf(" \ nError .." ;);

getch();

}

}

bc = 0;

返回0;

}


int getnodecount()

{

int i ,h = 0;

for(i = 0; i< 256; i ++)

{

if(leaf [i] .freq == 0)

h ++;

}

返回(255-h);

}


int comparenode(sn * a,sn * b)

{

if(a-> c == b-> c&& a-> freq == b-> freq&& a-> up == b-> up&& a-> left == b-> left

&& a-> right == b-> right)

返回0;

返回-1;

}


/ * void freetree(sn * hd)

{

if(!hd)

返回;

freetree(hd - > le ft);

freetree(hd - >右);

免费(高清);

} * /


现在我的问题是

1)如何正确实现函数freetree。

2)任何人都可以解释refreshbuffer函数

i表示刷新缓冲区函数写入编码位模式

使用

fputc函数。


fputc函数的功能如下

int fputc(int ch,FILE * $)
将参数ch

指定的字符(无符号字符)写入指定的流并前进

stream.On成功返回角色。如果发生错误,

设置流的错误指示器并返回EOF。


现在我的问题是如何实现压缩,如果我们是写一下这个


3)这两个陈述在这个

计划中的目的是什么?


fputc(getoddchar(),fq);

fputc(bc,fq);

Hi all,

this is the program which I saw in my colleagues book. the program was
run on turbo C++ 3.0 compiler

/*beginning of header file huff.h*/
#ifndef _HUFF_H_
#define _HUFF_H_

#include <io.h>
#include <conio.h>
#include<stdio.h>

typedef struct node
{
unsigned char c;
unsigned long int freq;
struct node *up,*left,*right;
}sn;

typedef struct ftable
{
unsigned long int freq;
}sft;

/*global variables*/
int buf[50],bc;
sft ft;
sn leaf[256];
sn *a,*t[256];

/*function prototypes*/

int initialize(char *);
/* operation: initialization function
post conditions: initializes all leaves to null values,barring the
character whose
frequency they point to.sets frequency values of the leaves
*/
int sortnode(int);
/* operation: sorting function
post conditions: sorts the pointer nodes in the decreasing order of
frequency*/

int getnodecount();
/* operation: get count of nodes with non zero frequency
post conditions: */

int createtree();
/* operation: creating the tree
post conditions: creats a non optimal huffman tree
to generate prefix codes
*/

int comparenode(sn*,sn*);
/* operation: node comparison
post conditions: returns 0 if both pointers point to same data
else returns -1
*/

void addtobuffer(int);
/* operation: initializing the bit buffer
post conditions: holds prefix codes for each leave nodes
*/

void refreshbuffer(FILE *);
/* operation: writing the coded prefix character
post conditions:
*/
/*void freetree(sn*);*/
char* getfilename(char *);
/* operation: obtaining the file name
post conditions: splits the file path to obtain the file name
*/

unsigned char getoddchar();
/* operation: same as that of refreshbuffer
pre conditions: bit buffer with less than 8 bits
*/

#endif

/*end of header file*/

/*
static version of huffman coding.
it is by no means optimal
compresses files above 3.25 kb
upper limit has not been determined upto 50K OK
usage of global variables
imperfect coding
usage of non standard functions lack of garbage collector leaves much
to be desired it might eat your memory if u are running this program on
old dos machines
*/

#include"huff.h"
int main(void)
{
FILE *fp,*fq;
int ch,i;
char fname[100],efile[100];
unsigned long int fsize,efsize;

clrscr(); /*non standard fn*/
printf("\nHuffman encoder");
printf("\nEnter the name of the input file(to be compressed):");
fgets(fname,100,stdin);
fname[strlen(fname)-1]=0;

printf("\nEnter the output filename(compressed file):");
fgets(efile,100,stdin);
efile[strlen(efile)-1]=0;

if(initialize(fname)==-1)
{
printf("\nError Could not open input file..");
return -1;
}
printf("\nInitialization over.\nPreparing to compress...");
if(createtree()==-1)
{
printf("\nMemory allocation error..");
return -1;
}
fq=fopen(efile,"wb");
if(!fq)
{
printf("\nError Could not open output file..");
fclose(fq);
return -1;
}
fp=fopen(fname,"rb");
if(!fp)
{
printf("\nError Could not open input file...");
fclose(fp);
return -1;
}
fsize=filelength(fileno(fp)); /*non std fn*/
/****To write the decoding table */
for(i=0;i<256;i++)
{
ft.freq=leaf[i].freq;
fwrite(&ft.freq,sizeof(struct ftable),1,fq);
}
/*To write the character that denotes the size of filenamelength*/
fputc(strlen(getfilename(fname))+1,fq);
/*To write the filename*/
fwrite(getfilename(fname),strlen(getfilename(fname ))+1,1,fq);
/***Completed writing of decoding table*****/
printf("\nCompressing...");
while(ch=fgetc(fp),ch!=EOF)
{
addtobuffer(ch);
refreshbuffer(fq);
}
fputc(getoddchar(),fq);
fputc(bc,fq);
fclose(fq);
printf("\nCompression complete.");
/*****For display of compression summary****/
fp=fopen(efile,"rb");
if(!fp)
{
printf("\nCould not open output file for analysis");
printf("\nCompression summary cannot be displayed");
return -1;
}
efsize=filelength(fileno(fp));fclose(fp);
printf("\n\nCompression summary\n");
printf("\nInput filesize :%lu bytes",fsize);
printf("\nOutput filesize:%lu",efsize);
printf("\nCompressed to %Lf%% of original size",((long
double)efsize*100/fsize));
return 0;
}
int sortnode(int z)/*sorts upto t[z] and not t[z-1]*/
{
int j,k;
sn* b;

for(k=0;k<=z;k++)
for(j=(k+1);j<=z;j++)
{
if((t[k]->freq)<(t[j]->freq))
{
b = t[k];
t[k] = t[j];
t[j] = b;
}
}
return 0;
}

char *getfilename(char *filepath)
{
char drive[4],dir[67],file[15],ext[5];
fnsplit(filepath,drive,dir,file,ext); //non standard fn
strcat(file,ext);
return file;
}
unsigned char getoddchar()
{
int i;
for(i=bc;i<8;i++)
{ buf[i]=0;}
return
((1*buf[7])+(2*buf[6])+(4*buf[5])+(8*buf[4])+(16*buf[3])+(32*buf[2])+(64*buf[1])+(128*buf[0]));
}

void refreshbuffer(FILE *p)
{
int i;
unsigned char q;
while(bc>=8)
{

q=(1*buf[7])+(2*buf[6])+(4*buf[5])+(8*buf[4])+(16*buf[3])+(32*buf[2])+(64*buf[1])+(128*buf[0]);
if(fputc(q,p)!=(unsigned)q || q<0 || q>255)printf("\nError");
for(i=8;i<bc;i++)
{buf[i-8]=buf[i];}
bc-=8;
}
}

void addtobuffer(int r)
{
int i,buftv[15];
int bct = -1,buft[15];

if(r>255 || r<0)
{
printf("\nValue error...");
getch();
}
a = &leaf[r];

while((a->up)!=NULL)
{
/* temp = a;*/
if(comparenode((a->up->left),a)==0)
{buft[++bct]=0;}
else if(comparenode((a->up->right),a)==0)
{ buft[++bct]=1;}
else
{printf("\nParent Error"); /*For debugging*/}

a=a->up;
}

for(i=0;i<=bct;i++)
{ buftv[bct-i]=buft[i];}

for(i=0;i<=bct;i++)
{buf[bc+i]=buftv[i];}

bc += bct+1;
return;
}
int createtree()
{
int i;
sortnode(255);
for(i=getnodecount();i>0;i--)
{
sortnode(i);
a = NULL;
a = (sn *)malloc(sizeof(sn));

if(!a)
{
printf("\nMemory allocation error...");
printf("\npress any key to continue...");
getch();
return -1; /*Memory allocation error*/
}
/*Assingning values*/
a->freq = (t[i]->freq)+(t[i-1]->freq);
a->right = t[i];
a->left = t[i-1];
a->up = NULL;
a->c = ''\0'';
t[i]->up = a;
t[i-1]->up = a;
t[i-1]=a;
}
return 0;
}
int initialize(char *filename)
{
int i,j;
FILE *fp;
for(i=0;i<256;i++)
{
leaf[i].c = i;
leaf[i].freq = 0;
leaf[i].up = NULL;
leaf[i].left = NULL;
leaf[i].right = NULL;
}

fp=fopen(filename,"rb");
if(!fp)
{ return -1; /*Could not open file */}

while(j=fgetc(fp),j!=EOF)
{
leaf[j].freq++;
if(j<0 || j>255)
{
printf("\nError..."); //should add a exit fn here
getch();
}
}
fclose(fp);
for(i=0;i<256;i++)
{
t[i]=&leaf[i];
if((t[i]->up)!=NULL)
{
printf("\nError..");
getch();
}
}
bc=0;
return 0;
}

int getnodecount()
{
int i,h=0;
for(i=0;i<256;i++)
{
if(leaf[i].freq==0)
h++;
}
return (255-h);
}

int comparenode(sn *a,sn *b)
{
if(a->c==b->c && a->freq==b->freq && a->up==b->up &&a->left==b->left
&& a->right==b->right)
return 0;
return -1;
}

/* void freetree(sn* hd)
{
if(!hd)
return;
freetree(hd -> left);
freetree(hd -> right);
free(hd);
}*/

now my questions are
1) how can the function freetree be implemented properly.
2) can anybody explain refreshbuffer funcion
i mean refresh buffer function writes the encoded bit pattern
using
fputc function.

the function of fputc function is as follows
int fputc(int ch, FILE *stream);

Writes a character (an unsigned char) specified by the argument ch
to the specified stream and advances the position indicator for the
stream.On success the character is returned. If an error occurs,
the error indicator for the stream is set and EOF is returned.

now my question is how compression is achieved,if we are writing ints

3) what exactly is the purpose served by these two statements in this
program???

fputc(getoddchar(),fq);
fputc(bc,fq);

推荐答案

在文章< 11 ********************** @ g49g2000cwa.googlegroups .com> ;,

< aa *** **@gmail.com>写道:
In article <11**********************@g49g2000cwa.googlegroups .com>,
<aa*****@gmail.com> wrote:
这是我在同事的书中看到的程序。该程序在turbo C ++ 3.0编译器上运行
/ *头文件的开头huff.h * /
#ifndef _HUFF_H_
#define _HUFF_H_
#include< io.h>
#include< conio.h>


这是DOS / Windows程序,不是标准C,所以对于错误分析

你应该访问dos / windows编程新闻组。 />

2)任何人都可以解释刷新缓冲区功能
我的意思是刷新缓冲区功能使用
fputc函数写入编码位模式。
fputc函数的功能如下:
int fputc(int ch,FILE * stream);
现在我的问题是如何实现压缩,如果我们正在编写内容
this is the program which I saw in my colleagues book. the program was
run on turbo C++ 3.0 compiler /*beginning of header file huff.h*/
#ifndef _HUFF_H_
#define _HUFF_H_ #include <io.h>
#include <conio.h>
That''s a DOS/ Windows program, not standard C, so for bug analysis
you should be visiting a dos/windows programming newsgroup .

2) can anybody explain refreshbuffer funcion
i mean refresh buffer function writes the encoded bit pattern
using
fputc function. the function of fputc function is as follows int fputc(int ch, FILE *stream); now my question is how compression is achieved,if we are writing ints




这是一个算法问题,而不是关于C的问题。 br />

让我举一个简短的例子:


假设你有输入abcdefghijXYZabcdefghijPQR。

这可以写出来,

1个字符,高位设置为表示转义。代码,

并且第二高位清楚表明这是

类型为literal string的转义,

和将低位设置为十进制9表示

后面的文字字符串长度为10(你从不

的长度为0所以不要浪费一个数)

10个字符是abcdefghij

3个字符是XYZ(高位必须清楚每个)

1个字符串高位设置表示转义,第二个最高设置

表示返回引用,低位设置为0表示

表示引用转义为发生的转义字符串最近

3个字符是PQR(高位必须清楚)


此表示的总长度为1 + 10 + 3 + 1 +3 = 18

而原始字符串占用26个字符。


这是否有助于更清楚地知道有时写出二进制文件

数据ca n导致压缩?输出二进制文件可以解释为
到-mean-某个东西,虽然编码

所需的开销数据 - 第一次可能比原始数据大,

如果该位数据重复了一段时间,如果

的编码参考很短且数据多次出现,则使用
$每次b $ b简短表示,并且在原始编码的

开销超过弥补之前不需要很长时间。


无论如何,我建议你不要继续这个特定的程序,

,你读comp.compression常见问题。

-

如果你撒谎对编译器来说,它会得到报复。 - Henry Spencer



That''s an algorithm question, rather than a question about C.

Let me give a short example:

Suppose you have the input "abcdefghijXYZabcdefghijPQR".
This could be written out as,
1 char with the high bit set to indicate an "escape" code,
and with the second-highest bit clear to indicate that this is
an escape of type "literal string",
and with the lower bits set to decimal 9 to indicate that
the literal string that follows is of length 10 (you never
have length 0 so don''t waste a count)
10 characters that are abcdefghij
3 characters that are XYZ (high bit must be clear on each)
1 char with high bit set to indicate escape, second highest set
to indicate "back reference", and the lower bits set to 0 to indicate
that the reference is to the escaped string that occured most recently
3 characters that are PQR (high bit must be clear on each)

The total length of this representation is 1+10+3+1+3 = 18
whereas the original string took 26 characters.

Does this make it clearer as to how sometimes writing out binary
data can result in compression? The output binary can be interpreted
to -mean- something, and although the overhead required to encode
the data the -first- time might be larger than the original data,
if that bit of data repeats a number of time, if the encoding of
the reference is short and the data occurs many times, you use the
short representation each time, and it doesn''t take long before the
overhead of the original encoding is more than made up for.

Anyhow, I suggest that rather than persuing this particular program,
that you read the comp.compression FAQ.
--
If you lie to the compiler, it will get its revenge. -- Henry Spencer


aa ***** @ gmail.com 写了392行,其中大部分是剪辑:
aa*****@gmail.com wrote 392 lines, most of which is snipped:
大家好,

这是我在同事的书中看到的程序。


请烧掉那本书。

程序在turbo C ++ 3.0编译器上运行

/ *头文件huff.h * /
#ifndef _HUFF_H_
#define _HUFF_H_


上面说明了一个非常糟糕的主意,使用以
开头的标识符
下划线。带有下划线的开头标识符后跟一个

大写字母更糟糕。避免这样的事情,除非你知道*

,当这些事情没有侵入保留给

实现的命名空间时。 " HUFF_H"也会这样做。
#include< io.h>


没有标题< io.h>标准C.

#include< conio.h>


没有标题< conio.h>标准C.


[...]

您的代码也退回到许多地方,返回非标准值

(不是0,EXIT_SUCCESS或EXIT_FAILURE)。


另外,你返回局部变量的地址,省略包含

的< string.h> ;和< stdlib.h> ;,省略fdushing stdout需要

在提示没有以''\ n''终止后,写0你想象的地方

''\ n''在由fgets填充的缓冲区中,并使用一些

非标准函数:clrscr(),filelength(),fileno(),fnsplit(),

getch()。上帝知道在这恐怖事件中还能找到其他垃圾。


使用幻数(100)代替FILENAME_MAX是一个坏主意。

现在我的问题是

1)如何正确实现函数freetree。
Hi all,

this is the program which I saw in my colleagues book.
Please burn that book.
the program was
run on turbo C++ 3.0 compiler

/*beginning of header file huff.h*/
#ifndef _HUFF_H_
#define _HUFF_H_
The above illustrates a very bad idea, using identifiers that begin with
an underscore. Beginning identifiers with an underscore followed by an
uppercase letter is even worse. Avoid such things unless you *know*
when such things do not invade the namespace reserved to the
implementation. "HUFF_H" would have done as well.
#include <io.h>
There is no header <io.h> in standard C.
#include <conio.h>
There is no header <conio.h> in standard C.

[...]
Your code also exits in a number of places returning non-standard values
(not 0, EXIT_SUCCESS, or EXIT_FAILURE).

In addition, you return addresses of local variables, omit the inclusion
of <string.h> and <stdlib.h>, omit fflushing of stdout where needed
after a prompt not terminated with ''\n'', write 0 where you imagine the
''\n'' to be in buffers filled by fgets, and use a number of
non-standard functions: clrscr(), filelength(), fileno(), fnsplit(),
getch(). God knows what other garbage is to be found in this horror.

Using a magic number (100) instead of FILENAME_MAX is a bad idea.
now my questions are
1) how can the function freetree be implemented properly.




担心程序是由三年级学生编写的谁拥有

从未学过C而不是试图修复一堆垃圾。



Worry about the fact that the program is written by a 3rd grader who has
never learned C rather than trying to fix a pile of crap.


Martin Ambuhl< ma ***** @ earthlink达网络>写道:
Martin Ambuhl <ma*****@earthlink.net> wrote:
请烧掉那本书。


这不是很强吗?我们不知道这本书的主题是什么,或者OP是否准确地转录了他在那里找到的东西,

或者确实是否有勘误来处理你的问题

突出显示。

担心程序是由三年级学生编写的,他们从未学过C而不是试图修复一堆垃圾。
Please burn that book.
Isn''t that a bit strong? We have no idea what the purported topic of
the book was or whether OP accurately transcribed what he found there,
or indeed whether there are errata that deal with the issues you
highlighted.
Worry about the fact that the program is written by a 3rd grader who has
never learned C rather than trying to fix a pile of crap.




我认为代码的质量表明它实际上并不是从任何文本中逐字复制的,即使是Schildt文本也是如此。


-

Christopher Benson-Manica |我*应该*知道我在说什么 - 如果我

ataru(at)cyberspace.org |不,我需要知道。火焰欢迎。



I think the quality of the code suggests that it was not, in fact,
copied verbatim from any text, even a Schildt text.

--
Christopher Benson-Manica | I *should* know what I''m talking about - if I
ataru(at)cyberspace.org | don''t, I need to know. Flames welcome.


这篇关于霍夫曼编码器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆