易截截图软件、单文件、免安装、纯绿色、仅160KB

linux获取网络接口名:如eth0

 #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<net/if.h>
static char *bad_interface_names[] = {
            "lo:",
            "lo",
            "stf",     /* pseudo-device 6to4 tunnel interface */
            "gif",     /* psuedo-device generic tunnel interface */
            "dummy",
            "vmnet",
            NULL        /* last entry must be NULL */
        };
static int is_bad_interface_name(char *i) {
    char **p;
    for (p = bad_interface_names; *p; ++p)
        if (strncmp(i, *p, strlen(*p)) == 0)
            return 1;
    return 0;
}
   
/* This finds the first interface which is up and is not the loopback
* interface or one of the interface types listed in bad_interface_names. */
static char *get_first_interface(void) {
    struct if_nameindex * nameindex;
    char *i = NULL;
    int j = 0;
    /* Use if_nameindex(3) instead? */
    nameindex = if_nameindex();
    if(nameindex == NULL) {
        return NULL;
    }
    while(nameindex[j].if_index != 0) {
        if (strcmp(nameindex[j].if_name, "lo") != 0 && !is_bad_interface_name(nameindex[j


相关文档:

很多程序死在linux 服务进程中

今天发现很多程序死在linux 服务进中
问个问题 今天发现很多程序死在linux 服务进中
已经死了好多天了。用crontab 都定在 凌晨0点跑。
想知道如何查看 服务器哪方面的资源太少导致进程死在里面?
ps -ef|grep load/script | awk '{print $2}' 把死进程的 ID 打印出来
......

linux c oci 远程连接例子

以下是我的测试oci的例子!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "oci.h"
static OCIServer        *srvhp;
static OCISession       *p_session;
static OCIEnv    &nb ......

公开 《Unix/Linux下的Curses库开发指南》全书内容

 《Unix/Linux下的Curses库开发指南》于2003年由清华出版社出版,合同在2008年结束。这是国内唯一的一本关于Curses库开发指南的图书。本书无意再版,因此特意公开全书内容,所有的章节会逐渐放出。希望对大家有用。 ......

Linux操作系统下的多线程编程详细解析(4)


   函数原型:
   
#include <pthread.h>
void pthread_cleanup_push(void (*rtn)(void *),void *arg);
    函数rtn是清理函数,arg是调用参数
void pthread_cleanup_pop(int execute);
 
 
    在前面讲过线程的终止方式,是正常终止还是非 ......

Linux 下的两个脚本

//videoserver
#!/bin/bash
#
# videoserver
#
# chkconfig: 3456 11 91
# description: videoserver
# Source function library.
. /etc/rc.d/init.d/functions
prog="videoserver"
start() {
# Start daemons.
echo -n $"Starting $prog: "
/video/videoserver/recordvideosvr /video/videoserver ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号