摘要:
ipsec status: # ipsec status Security Associations (1 up, 0 connecting): 2[3]: ESTABLISHED 9 minutes ago, 172.16.5.102[CN=server, C=CN]...172.16.5.104 阅读全文
摘要:
问题描述 搭建nginx服务后,在index.html文件中嵌入php代码,浏览器会将php代码注释掉,进而不解释php代码。 解决方法 首先修改nginx.conf配置文件(或者其他的nginx配置文件),修改内容如下: location ~ \.php|\.html$ { // 修改位置,原 阅读全文
摘要:
今天在调用strsep函数时,报了Segmentation fault错误,strsep函数原型如下: char *strsep(char **stringp, const char *delim); 第一个参数是个二级指针,而且没有const修饰,我猜测在man手册中只要是添加const修饰的参数 阅读全文
摘要:
// 使用popen代替system函数 int my_system(const char * cmd) { FILE * fp; int res;if (cmd == NULL) { printf("my_system cmd is NULL!\n"); return -1; } if ((fp 阅读全文
摘要:
今天在写程序的时候,需要用到system函数,早就知道system函数存在使用风险,但是只知其然不知其所以然,好在早有大佬研究过了,以下转自:https://blog.csdn.net/u011006622/article/details/77643680 留作记录,以便查询。 这几天调程序(嵌入式 阅读全文
摘要:
1 #include <stdbool.h> 2 #include <sys/types.h> 3 #include <sys/stat.h> 4 #include <unistd.h> 5 6 bool file_exist(const char *path) // 返回值:0 - 不存在, 1 阅读全文
摘要:
使用 mtrace 分析 “内存泄漏” Wang Chen 创作于 2019/09/09 打赏 By unicornx of TinyLab.org Aug 10, 2019 1 内存泄漏导论 在工作中,特别是采用 C 语言编写程序时,动态内存分配是常有的事,而伴随动态内存分配而来的最大的问题就是所 阅读全文
摘要:
1. 函数格式: 1 #include <mcheck.h> 2 3 void mtrace(void); 4 5 void muntrace(void); mtrace 用于开启内存使用记录,muntrace用于取消内存使用记录。内存使用情况记录到一个文件,值由环境变量:MALLOC_TRACE决 阅读全文
摘要:
1、添加打印信息确定问题具体位置。 2、使用gdb调试,确定问题点。 3、使用core dump确定问题位置。 在main函数开头处添加以下代码,程序运行后,会在程序所在文件夹下生成core.xxx文件,然后使用此命令行:gdb ./myProgram core.xxx 这种办法和gdb调试是一样的 阅读全文
摘要:
转自:https://www.cnblogs.com/bossren/p/6369330.html 缓冲区: 输入缓冲区 键盘—》键盘缓冲区—》输入缓冲区—》程序(scanf函数) 我们在键盘上输入的任何东西,会先进入输入缓冲区区域,然后程序从输入缓冲区里把数据一个一个读出来。 输入缓冲区的管理方式 阅读全文