
算法,常用代码
huzk4409
这个作者很懒,什么都没留下…
展开
-
哈希表简单实现
#include <string.h>#include <stdio.h>#include <stdlib.h>typedef struct _node{ char *name; char *desc; struct _node *next;}node;#define HASHSIZE 10static node* has...转载 2018-12-10 17:15:50 · 256 阅读 · 0 评论 -
find_mac_from_arptbl find_ip_from_mac
static int find_ip_from_mac(const char *stamac, char *staip){ FILE *fp = NULL; char match_cmd[256] = {0}; char match_line[256] = {0}; sprintf(match_cmd, "cat /proc/net/arp | grep %s ...原创 2018-08-23 17:15:19 · 194 阅读 · 0 评论 -
读文件内容
FILE *pFile = NULL; char g_media_version[64]; if(0 != access("/tmp/storage/sda1/rsync_success", F_OK)) { pFile = fopen("/tmp/storage/sda1/http_last_version","r"); i...原创 2018-08-23 15:56:02 · 158 阅读 · 0 评论 -
linux系统用c语言获取设备mac
#include <net/if.h>#include <net/if_arp.h>static int get_device_mac(u8 *mac, const char *dev_name){ int ret = 0, i = 0; int fd = -1; struct ifreq ifr; if (NULL == mac...原创 2018-07-31 16:49:34 · 1513 阅读 · 0 评论