摘要:#include <stdio.h> #include <string.h> static void copypath(const char *src, char *dst, size_t dstlen) { char *end = dst + dstlen - 1; /* Copy the str
阅读全文
摘要:#include <stdio.h> #include <signal.h> #include <unistd.h> #include <getopt.h> static pid_t PidOutPut (char *path) { FILE *fp; pid_t pid; pid = getpid
阅读全文
摘要:#include <stdio.h> #include <string.h> int write_change_policy(const char* filename,char* buf_policy) { FILE *fp = NULL; fp = fopen(filename,"w+"); if
阅读全文
摘要:#include <stdio.h> #include <string.h> #define BUF_SIZE 1024 #define MAX_NAME_SIZE 1024 int running_command(const char *command,char *result) { FILE *
阅读全文
摘要:int get_sys_type(char *dst) { void *ptr = NULL; if (sizeof(ptr) == 4) sprintf(dst,"32"); else sprintf(dst,"64"); return 0; } int main() { char paht[25
阅读全文
摘要:#include <memory.h> //从文件件路径中获取文件名 void GetFileName(char *path,char *filename) { char *ptr = NULL; ptr = strrchr(path,'/'); if (!ptr) return; memcpy(f
阅读全文
摘要:#include <memory.h> //从文件件路径中获取文件名 void GetFileName(char *path,char *filename) { char *ptr = NULL; ptr = strrchr(path,'/'); if (!ptr) return; memcpy(f
阅读全文
摘要:#include <string.h> #include <stdio.h> int main(int argc, char **argv) { char p[32]; char q[32]; strcpy(p, "123456789"); strcpy(q, "987654321"); print
阅读全文
摘要:函数名: calloc 函数原型:void* calloc(unsigned int num,unsigned int size); 功能:在内存的动态存储区中分配num个长度为size的连续空间,函数返回一个指向分配起始地址的指针;如果分配不成功,返回NULL。 #define XCALLOC(x
阅读全文
摘要:ssize_t与size_t-linux ssize_t: signed size_t [注释:signed 有符号] size_t: 标准C库中定义的,应为unsigned int [注释:unsigned 无符号] 一、size_t 增强移植性: [注释:不同的系统上,定义size_t可能不一样
阅读全文
摘要:#include <stdio.h> static char* g_templname[2] = { "blacknamelist", "whitenamelist" }; #define ChangState(who,state) \ do { \ who = state; \ }while (0
阅读全文
摘要:#include <stdio.h> static char* g_templname[2] = { "blacknamelist", "whitenamelist" }; int main() { printf("%s\n",g_templname[1]); printf("Hello, Worl
阅读全文
摘要:vector 的reserve增加了vector的capacity,但是它的size没有改变!而resize改变了vector的capacity同时也增加了它的size!原因如下: reserve是容器预留空间,但在空间内不真正创建元素对象,所以在没有添加新的对象之前,不能引用容器内的元素。加入新的
阅读全文
摘要:std::unique_ptr<SocksClient> sockclient = std::unique_ptr < SocksClient > (new SocksClient()); sockclient.get()->socks_client_open(1); 回调中定义类的智能指针对象 一
阅读全文
摘要:strstr(str1,str2) 函数用于判断字符串str2是否是str1的子串
阅读全文
摘要:signal(SIGALRM, alarmhandle); 表示给当前进程注册SIGALRM信号处理代码,如果收到SIGALRM信号,就会去执行alarmhandle函数 实际运用中,需要对不同到signal设定不同的到信号处理函数,SIG_IGN忽略/SIG_DFL默认,这俩宏也可以作为信号处理函
阅读全文
摘要:msleep是休眠函数,它不涉及忙等待.用msleep(200)的时候实际上延迟的时间,大部分时候是要多于200ms,是个不定的时间值.
阅读全文
摘要:(2)修饰全局变量 对于一个全局变量,它既可以在本源文件中被访问到,也可以在同一个工程的其它源文件中被访问(只需用extern进行声明即可)。 如: 有file1.c int a=1; file2.c #include<stdio.h> extern int a; int main(void) {
阅读全文
摘要:https://blog.csdn.net/chollima/article/details/8158580
阅读全文