日志清空c语言版本
跳到导航
跳到搜索
wipelog.c
#include<stdio.h> #include <stdlib.h> int main() { FILE *fp; if ((fp=fopen("/opt/mycat/logs/wrapper.log","r")) == NULL) //if ((fp=fopen("./test.log","r")) != NULL) // 如果是要清空 记得打开这行 注释上面行 { printf("be opened.\n"); fp=fopen("/opt/mycat/logs/wrapper.log","w"); fclose(fp); //exit(1); } }