谁注册了丁丁

导航

2015年5月6日 #

vi技巧合集

摘要: VIM 技巧 match & replace match the whole word(eg: match printf but not snprintf/fprintf)You can use \ to match the end: %s/\/PRINTF/gc match the current line to last line of file .,$s/printf/PRINTF/gc ... 阅读全文

posted @ 2015-05-06 11:42 leaker 阅读(122) 评论(0) 推荐(0) 编辑

2013年11月15日 #

longjmp setjmp and volatile

摘要: 1 /******************************************************************************* 2 * 版权所有: 3 * 模 块 名: 4 * 文 件 名:volatile_setjmp.c 5 * 实现功能: 6 * 作 者:XYZ 7 * 版 本:V1.0 8 * 日 期:2013.11.15 9 * 联系方式:xiao13149920@foxmail.com10 ********************************************************************... 阅读全文

posted @ 2013-11-15 12:38 leaker 阅读(341) 评论(0) 推荐(0) 编辑

2013年11月7日 #

查找n个数字中的最大值

摘要: 闲来无事,试试用arg_list查找n个数字中的最大者. 又因为本人喜欢模板, 所以就早早的写了以下代码, 没有经过严格测试./******************************************************************************** 版权所有:* 模 块 名:* 文 件 名:template_max_value.cpp* 实现功能:取不定数目的数值中的最大值* 作 者:leaker* 版 本:V1.0* 日 期:2013.11.07* 联系方式:xiao13149920@foxmail.com**************... 阅读全文

posted @ 2013-11-07 14:15 leaker 阅读(979) 评论(0) 推荐(0) 编辑

Printing 1 to 1000 without loop or conditionals

只有注册用户登录后才能阅读该文。 阅读全文

posted @ 2013-11-07 12:02 leaker 阅读(19) 评论(0) 推荐(0) 编辑

2013年8月19日 #

进程间通信--pipe

摘要: 管道的两种局限性:历史上,他们是半双工的(即数据只能够在一个方向上流动). 现在某些系统也提供全双工管道,但是为了最佳的移植性,我们决不应该预先假定系统使用此特性他们只能够在具有公共祖先的进程间使用. 通常一个管道由一个进程创建, 然后该进程通过调用fork, 此后父,子进程之间就可以使用该管道尽管有这两种局限, 但半双工管道仍然是最常用的 IPC 形式.管道由调用pipe函数创建:#includeint pipe(int filedes[2]);返回值: 0: 成功, -1: 失败经由参数filedes返回的两个文件描述符:filedes[0]: 读filedes[1]: 写filedes[ 阅读全文

posted @ 2013-08-19 11:34 leaker 阅读(321) 评论(0) 推荐(0) 编辑

2013年8月12日 #

构造函数,const char*与c_str

摘要: 1 /******************************************************************************* 2 * 版权所有: 3 * 模 块 名: 4 * 文 件 名:class_default_constructor_for_const_member.cpp 5 * 实现功能: 6 * 作 者:XYZ 7 * 版 本:V1.0 8 * 日 期:2013.08.12 9 * 其他说明:xiao13149920@foxmail.com10 ***************************************... 阅读全文

posted @ 2013-08-12 13:34 leaker 阅读(546) 评论(0) 推荐(0) 编辑

2013年8月1日 #

线程间通信--互斥量

摘要: 1 /******************************************************************************* 2 * 版权所有: 3 * 模 块 名: 4 * 文 件 名:pthread4_addnum.c 5 * 实现功能: 6 * 作 者:XYZ 7 * 版 本:V1.0 8 * 日 期:2013.07.26 9 * 其他说明:无10 ********************************************************************************/11 // pthr... 阅读全文

posted @ 2013-08-01 10:20 leaker 阅读(348) 评论(0) 推荐(0) 编辑

2013年7月29日 #

Linux下man安装及使用方法

摘要: 常用法:man [section] name其中:section指的是手册页的哪个部分,可以是1、2、3…8.,若不指定,man会按照次序依次查找,知道找到第一个。name指的是某个命令、函数或文件下面对section做一些说明: 1 =命令(比如cp mv rm等) 2 =系统调用 (比如openread close等) 3 = C库函数 (比如printf) 4 =设备和特殊文件 5至 8省略, 详细说明请查看: man man例子:man cp == man 1 cp, 1通常省略man open == man 2 open,但如果用man 3open的话就出错:No entry for 阅读全文

posted @ 2013-07-29 11:36 leaker 阅读(1287) 评论(0) 推荐(0) 编辑

2013年7月25日 #

线程间通信--线程创建与销毁

摘要: 1. pthread_create(&a_thread, NULL, thread_function, (void *)message); pthread_create(&a_thread, NULL, thread_function, (void *)num);原型: #include int pthread_create(pthread_t *restrict thread, const pthread_attr_t *restrict attr, void *(*start_routine)(void*), ... 阅读全文

posted @ 2013-07-25 10:27 leaker 阅读(983) 评论(0) 推荐(0) 编辑

2013年7月24日 #

进程间通信--fork函数

摘要: #include pid_t fork(void);fork() creates a new process by duplicating the calling process.1. 一个进程通过调用fork会创建一个被称为子进程的副本。父进程从调用fork()的地方执行,子进程也一样2. 子进程是一个新建立的进程,因此有一个与父进程不一样的进程ID。因此可以通过调用getpid()检测自身运行的子进程还是父进程。3. 不过,fork函数对父子进程提供不同的返回值--一个进程“进入“fork()调用,而另外一个则从调用中“出来“。父进程得到的fork()调用的返回值是子进程的ID,子进程得到 阅读全文

posted @ 2013-07-24 15:55 leaker 阅读(965) 评论(0) 推荐(0) 编辑