我正在学习apue,很多东西看了之后就忘,我想知道有没有一些有趣的练习方面的书籍,这样可以练习学过的知识,还能找到乐趣,比如说一些小的游戏之类的...谢过了~
by boerhawking - C/C++ - 2008-12-10 08:15:27 阅读(4124) 回复(21)
[code]#define HASH(fp) (((unsigned long )fp)%29) struct foo *fh[29]; struct foo{ int f_count; struct foo *f_next; }; foo_alloc{ struct foo *fp; int idx; if((fp=malloc(siezof(struct foo)))!=NULL){ ....... idx=HASH(fp);/*这个idx的值能是什么呢?*/ fp->f_next=fh[idx]; /*这里什么意思?是将那...
系统是solaris9,按
我在mac 10.5下编译apue2.e。已根据http://www.apuebook.com/上FAQs 将CMSG_LEN的定义在apue.h加了进去。可还是出现以下错误。 loop.c:11: error: syntax error before ‘allset’ loop.c:11: warning: type defaults to ‘int’ in declaration of ‘allset’ loop.c:11: warning: data definition has no type or storage class loop.c: In function ‘loop’: loop.c:20: error: ‘fd_set’ undeclared (first use in this func...
最近在看apue, 看到信号这一章的时候有这样的一个例子!(部分) int sig_int(), sig_quit(); if (signal(SIGINT, SIG_IGN) != SIG_IGN) signal(SIGINT, sig_int); if (signal(SIGQUIT, SIG_IGN) != SIG_IGN) signal(SIGQUIT, sig_quit) 看到第一行,int sig_int(), sig_quit(); 给我的感觉像是定义了两个int变量! 但看下面的两句却是把它们当成函数! 但是如果函数,从来没有见过这种定义方式! 了解的朋友说说原因! ...
apue中的出错处理中用到了MAXlINE 我的linux显示未定义 我现在的做法是用define 我想知道Linux下如何找这个MAXLINE [ 本帖最后由 zszjxh 于 2008-6-27 13:00 编辑 ]
再结构struct acct 之前定义了 [code] typedef u_short comp_t; /*3_bit base 8 exponent;13_bit fracion*/ [/code] 然后是一个函数 [code] static unsigned long compt2ulong(comp_t comptime) /* convert comp_t to unsigned long */ { unsigned long val; int exp; val = comptime &0x1fff; /* 13-bit fraction */ exp = (comptime >> 13) & 7; /* 3-bit exponent (0-7) */ while (exp-- > 0) val *= 8...
再apue给出的头文件apue.h中声明了要用的函数 [CODE] char *path_alloc(int *) [/CODE] 这个函数path_alloc()具体的内容第二章已经写好了,但是不知道如何包含到这个头文件中,下次直接用就行拉. 不用将那些无耻的代码再粘贴进去. 要是不弄的话,编译的时候就说我 undefined referencre to 'path_alloc'
大家好,我刚看了100页,有些问题请教一下大家:
1,