摘要: http://blog.csdn.net/ztz0223/article/details/3599016http://codepad.org/DuNYSPrw//在结构体最后定义一个长度为0的字符数组(技巧)http://blog.chinaunix.net/uid-27025492-id-3271... 阅读全文
posted @ 2013-04-02 22:49 lxk613 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Linux环境进程间通信(五): 共享内存(上)http://www.ibm.com/developerworks/cn/linux/l-ipc/part5/index1.htmlLinux环境进程间通信(五): 共享内存(下)http://www.ibm.com/developerworks/cn/linux/l-ipc/part5/index2.html对话 UNIX: 通过共享内存进行进程间通信http://www.ibm.com/developerworks/cn/aix/library/au-spunix_sharedmemory/index.html?ca=drs-多线程编程:ht 阅读全文
posted @ 2012-04-22 08:28 lxk613 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 1.处理被中断的系统调用 对于可能永远阻塞的的系统调用,称为慢系统调用(slow system call),永远阻塞的系统调用指调用有可能永远无法返回。例如,没有客户端连接到服务器上,那么服务器的accept就木有返回的保证。对管道和终端设备的读写也是一个慢系统调用的例子,而磁盘I/O是个例外,一般都会返回到调用者。 适用于慢调用的基本原则:当阻塞于某个慢系统调用的进程捕获某个信号且相应信号处理函数返回时,该系统调用可能返回EINTR错误。当编写捕获信号的程序时需要考虑慢系统调用返回EINTR有所准备。有些内核自动重启被中断的系统调用。2.wait和waitpid函数 #include ... 阅读全文
posted @ 2012-02-22 10:52 lxk613 阅读(804) 评论(0) 推荐(0) 编辑
摘要: 原文连接:http://coolshell.cn/articles/5426.html英文连接http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/vim的学习曲线相当的大(参看各种文本编辑器的学习曲线),所以,如果你一开始看到的是一大堆VIM的命令分类,你一定会对这个编辑器失去兴趣的。下面的文章翻译自《Learn Vim Progressively》,我觉得这是给新手最好的VIM的升级教程了,没有列举所有的命令,只是列举了那些最有用的命令。非常不错。——————————正文开始——————————你想以最快的速度学习人 阅读全文
posted @ 2012-02-21 16:32 lxk613 阅读(107) 评论(0) 推荐(0) 编辑
摘要: http://stackoverflow.com/questions/8774567/c-macro-to-create-a-bit-mask-possible-and-have-i-found-a-gcc-bug 阅读全文
posted @ 2012-01-08 14:36 lxk613 阅读(125) 评论(0) 推荐(0) 编辑
摘要: http://stackoverflow.com/questions/2583580/what-is-the-best-way-to-write-class-template-like-generic-code-in-cstruct list_element_s{void* data;struct list_element_s next;};typedef struct list_element_s list_element;struct list_s{void (*destructor)(void* data);int (*com)(const void *src,const void* . 阅读全文
posted @ 2012-01-06 17:06 lxk613 阅读(197) 评论(0) 推荐(0) 编辑
摘要: View Code typedef struct LList LList; struct LList { int value; LList *next; }; LList *(*p)[3]; /* pointer to an array of 3 pointers to LList */ LList ll1 = {11}; LList ll2 = {22}; LList ll3 = {33}; size_t sizeofarray = sizeof*p/sizeof**p; /* calc arraysize at runtime here */ p = malloc( sizeofarra. 阅读全文
posted @ 2012-01-02 14:23 lxk613 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 创建多维数组,并差创建数组指针进行操作View Code #include <stdio.h> int main(int argc, char **argv) { int shape1[5][3] = {1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0}; int shape2[5][3] = {0,0,0, 0,0,0, 0,1,1, ... 阅读全文
posted @ 2012-01-01 16:46 lxk613 阅读(420) 评论(0) 推荐(0) 编辑
摘要: View Code #include <stdio.h>int main (void) { arrayPointer(); int arr[3] = {11,3,4}; int *p1; char *p2=(char*)arr; int i; int size1=sizeof(arr)/sizeof(arr[0]); int size2=(int)sizeof(arr); p1 = arr; printf("*p1=%d,size1=%d\n", *p1,size1); printf("*p2=%d,size2=%d\n"... 阅读全文
posted @ 2012-01-01 16:05 lxk613 阅读(233) 评论(0) 推荐(0) 编辑
摘要: Error code: #include<stdio.h> #include<string.h> #include<ctype.h> #include<stdlib.h> int main(void) { char *foo[100];//array of pointer strcpy(f00[0],”测试"); printf(“%s”,foo[0]); return 1; } 问题: 分配了一个... 阅读全文
posted @ 2011-12-30 16:19 lxk613 阅读(115) 评论(0) 推荐(0) 编辑