02 2021 档案

摘要:今天在调用strsep函数时,报了Segmentation fault错误,strsep函数原型如下: char *strsep(char **stringp, const char *delim); 第一个参数是个二级指针,而且没有const修饰,我猜测在man手册中只要是添加const修饰的参数 阅读全文
posted @ 2021-02-04 16:39 insistYuan 阅读(917) 评论(0) 推荐(0)
摘要:// 使用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 阅读全文
posted @ 2021-02-02 15:46 insistYuan 阅读(942) 评论(0) 推荐(0)
摘要:今天在写程序的时候,需要用到system函数,早就知道system函数存在使用风险,但是只知其然不知其所以然,好在早有大佬研究过了,以下转自:https://blog.csdn.net/u011006622/article/details/77643680 留作记录,以便查询。 这几天调程序(嵌入式 阅读全文
posted @ 2021-02-02 15:38 insistYuan 阅读(292) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2021-02-02 10:18 insistYuan 阅读(522) 评论(0) 推荐(0)