易截截图软件、单文件、免安装、纯绿色、仅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 Bluetooth编程 (七) SDP协议

Service Discovery Protocol(SDP)提供一种能力,让应用程序有方法发现哪种服务可用以及这种服务的特性。
服务发现协议(SDP或Bluetooth SDP)在蓝牙协议栈中对蓝牙环境中的应用程序有特殊的含意,发现哪个服务是可用的和确定这些可用服务的特征。SDP定义了bluetooth client发现可用bluetooth server服务和它们的特征的方法。 ......

很多程序死在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 ......

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


2、线程的终止
    如果进程中任何一个线程中调用exit,_Exit,或者是_exit,那么整个进程就会终止,
    与此类似,如果信号的默认的动作是终止进程,那么,把该信号发送到线程会终止进程。
    线程的正常退出的方式:
       (1) 线程 ......

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


3、线程标识
    函数原型:
   
#include <pthread.h>
pthread_t pthread_self(void);
pid_t getpid(void);
    getpid()用来取得目前进程的进程识别码,函数说明
    例程8
    程序目的:实现在新建立的线程中打印该线程的id和进 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号