摘要: --fork调用的一个奇妙之处就是它仅仅被调用一次,却能够返回两次,它可能有三种不同的返回值: 1)在父进程中,fork返回新创建子进程的进程ID; 2)在子进程中,fork返回0; 3)如果出现错误,fork返回一个负值; 在fork函数执行完毕后,如果创建新进程成功,则出现两个进程,一个是子进程 阅读全文
posted @ 2019-08-19 09:01 boboyou 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 1、 int (*pfun)(int, int); --通过括号强行将pfun首先与“*”结合,也就意味着,pfun是一个指针,接着与后面的“()”结合,说明该指针指向的是一个函数,然后再与前面的int结合,也就是说,该函数的返回值是int。由此可见,pfun是一个指向返回值为int的函数的指针。 阅读全文
posted @ 2019-08-17 20:45 boboyou 阅读(511) 评论(0) 推荐(0) 编辑
摘要: 1、in_cksum --计算校验和 阅读全文
posted @ 2019-08-16 15:15 boboyou 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 2、关于类型转化有一篇很好的文章,讲解的很清楚,下面附上连接 https://blog.csdn.net/zcyzsy/article/details/70888379 阅读全文
posted @ 2019-08-16 10:13 boboyou 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 1、undefinded reference to --问题原因:链接时缺少目标文件(.文件) --有三个文件 add.c\\sub.c\\1.c,其中add和sub是要被1中调用的函数 则编译时 要用 gcc -o 1 add.c sud.c 1.c,注意不能忽略add.和sub.c 2、inco 阅读全文
posted @ 2019-08-15 16:22 boboyou 阅读(181) 评论(0) 推荐(0) 编辑
摘要: --从github上下载的Linux内核中是没有这个文件的,在具体的操作系统中才能找到这个文件, 可以用locate命令来定位 --包含hostent结构 阅读全文
posted @ 2019-08-14 20:17 boboyou 阅读(502) 评论(0) 推荐(0) 编辑
摘要: 可以确定一个文件的位置,非常好用 阅读全文
posted @ 2019-08-14 20:14 boboyou 阅读(123) 评论(0) 推荐(0) 编辑
摘要: union中的各个字段共享同一块内存区域 typedef union { undigned short int value; unfigned char bytes[2]; }to; to typeorder; typeorder.value = 0xabcd; 那么: bytes[0] = 0xc 阅读全文
posted @ 2019-08-14 16:40 boboyou 阅读(394) 评论(0) 推荐(0) 编辑
摘要: 1、ssize_t: --typedef signed long ssize_t--在tools/include/noblic中有定义 --In short, ssize_t is the same as size_t, but is a signed type - read ssize_t as 阅读全文
posted @ 2019-08-14 14:57 boboyou 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 1、in.h: An implementation of the TCP/IP protocol suite for the LINUX operating system. INET is implemented using the BSD Socket interface as the means 阅读全文
posted @ 2019-08-14 10:30 boboyou 阅读(225) 评论(0) 推荐(0) 编辑