c语言 13-9

1、

#include <stdio.h>
#include <ctype.h>

int main(void)
{
    int ch;
    FILE *sfp;
    FILE *dfp;
    char sfile[FILENAME_MAX];
    char dfile[FILENAME_MAX];
    
    printf("sfile name: "); scanf("%s", sfile);
    printf("dfile name: "); scanf("%s", dfile);
    
    if((sfp = fopen(sfile, "r")) == NULL)
        printf("\asfile open failed.\n");
    else
    {
        if((dfp = fopen(dfile, "w")) == NULL)
            printf("\adfile open failed.\n");
        else
        {
            while((ch = fgetc(sfp)) != EOF)
            {
                putchar(toupper(ch));
                fputc(toupper(ch), dfp);    
            }
            fclose(dfp);
        }
        fclose(sfp);
    } 
    return 0;
}

c语言 13-9

 

上一篇:IDEA输出乱码“淇℃伅”


下一篇:解决ojdbc7依赖下载失败