1、
#include <stdio.h> int main(void) { FILE *fp; char filename[128]; printf("filename: "); scanf("%s", filename); fp = fopen(filename, "r"); if(fp != NULL) { fp = fopen(filename, "w"); printf("%s clear successfully!", filename); fclose(fp); } else { printf("%s does not exist\a.\n", filename); } return 0; }