日志清空c语言版本

来自linux中国网wiki
跳到导航 跳到搜索

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);
                
        }
}