其他分享
首页 > 其他分享> > c语言 13-2

c语言 13-2

作者:互联网

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

 

 

 

标签:fp,13,语言,int,successfully,filename,printf,fopen
来源: https://www.cnblogs.com/liujiaxin2018/p/14854600.html