Linux C/C++
bcg448251593
这个作者很懒,什么都没留下…
展开
-
Linux 获取本地ip
#include #include #include #include #include #include #include #include #include #define ETH_NAME "eth0"unsigned int get_local_ip(){int sock;struct sockaddr_in sin原创 2015-09-16 13:20:56 · 437 阅读 · 0 评论 -
libevent 服务器框架使用
libevent是一个开源的服务器框架.跨平台.自带http服务等.源码可以自行网上搜索 也可以到 http://448251593.7958.com/down_19930979.html下载下来之后在Linux下解压 然后进入目录libevent-2.0.22-stable执行./configure --prefix=/libevent/(make install的时候会把库cp到这个目原创 2015-09-16 13:29:54 · 453 阅读 · 0 评论 -
建立自己的libevent工程
根据sample的例子建立自己的服务器工程,1.创建一个目录libevent_pro2.进入目录里面,创建文件inc src Makefile3.把libevent的库文件都拷贝到liebevent_pro4.把sample里面那个hello-world.c文件拷贝到libevent/src,并把后缀名称修改为cpp(c++做服务器还是有很多东西可以用的.改cpp方便或者标准一点)原创 2015-09-17 10:43:42 · 471 阅读 · 0 评论 -
opencv 训练器的制作笔记
开发环境:Ubuntu摸索了很久.发现网上大部分的都是windows的笔记.很多命令参数都不一样.Ubuntu下编译并安装好了opencv后直接就能找到 opencv_createsamples opencv_traincascade等相关命令1.制作样本用如下的命令opencv_createsamples -vec sample.vec -info sample.txt -原创 2015-12-11 13:19:29 · 573 阅读 · 0 评论 -
Linux 内核list使用
源码:#ifndef LIST_H#define LIST_H 1struct list_head {struct list_head *next, *prev;};#define LIST_HEAD_INIT(name) { &(name), &(name) }#define LIST_HEAD(name) \struct list_he原创 2015-12-24 10:42:53 · 490 阅读 · 0 评论 -
sem_timedwait 会被signal的信号唤醒及处理办法
一直都在使用sem_timedwait 函数用来处理超时等待应答.但是突然发现 没有收到应答.竟然返回了.查了半天竟然是signal(SIGALRM, ....)的原因.man 了一下 sem_timedwait RETURN VALUE All of these functions return 0 on success; on error, the value of th原创 2015-12-24 14:56:14 · 1764 阅读 · 0 评论