zoukankan      html  css  js  c++  java
  • c语言 13-8 、13

    13-8、

    #include <stdio.h>
    
    int main(void)
    {
        FILE *sfp;
        FILE *dfp;
        int ch;
        char sfilename[FILENAME_MAX];
        char dfilename[FILENAME_MAX];
        printf("Please input the sfilename: "); scanf("%s", sfilename);
        printf("Please input the dfilename: "); scanf("%s", dfilename);
        
        if((sfp = fopen(sfilename, "r")) == NULL)
            printf("aSource file open failed.
    ");
        else
        {
            if((dfp = fopen(dfilename, "w")) == NULL)
                printf("aDestination file open failed.
    ");
            else
            {
                while((ch = fgetc(sfp)) != EOF)
                {
                    putchar(ch);
                    fputc(ch, dfp);
                }
                fclose(dfp);
            }
            fclose(sfp);
        } 
        return 0;
    }

    13 - 9、

    #include <stdio.h>
    #include <ctype.h>
    
    int main(void)
    {
        FILE *sfp;
        FILE *dfp;
        int ch;
        char sfilename[FILENAME_MAX];
        char dfilename[FILENAME_MAX];
        printf("Please input the sfilename: "); scanf("%s", sfilename);
        printf("Please input the dfilename: "); scanf("%s", dfilename);
        
        if((sfp = fopen(sfilename, "r")) == NULL)
            printf("aSource file open failed.
    ");
        else
        {
            if((dfp = fopen(dfilename, "w")) == NULL)
                printf("aDestination file open failed.
    ");
            else
            {
                while((ch = fgetc(sfp)) != EOF)
                    fputc(toupper(ch), dfp);
                fclose(dfp);
            }
            fclose(sfp);
        }
        return 0;
    }

    13-10、

    #include <stdio.h>
    #include <ctype.h>
    
    int main(void)
    {
        FILE *sfp;
        FILE *dfp;
        int ch;
        char sfilename[FILENAME_MAX];
        char dfilename[FILENAME_MAX];
        printf("Please input the sfilename: "); scanf("%s", sfilename);
        printf("Please input the dfilename: "); scanf("%s", dfilename);
        
        if((sfp = fopen(sfilename, "r")) == NULL)
            printf("aSfilename open failed.
    ");
        else
        {
            if((dfp = fopen(dfilename, "w")) == NULL)
                printf("aDfilename open failed.
    ");
            else
            {
                while((ch = fgetc(sfp)) != EOF)
                    fputc(tolower(ch), dfp);
                fclose(dfp);
            }
            fclose(sfp);
        }
        return 0;
    }
  • 相关阅读:
    ssh连接虚拟机centos
    centos安装vim
    CentOS 使用yum命令安装出现错误提示”could not retrieve mirrorlist http://mirrorlist.centos.org
    java多线程之yield,join,wait,sleep的区别
    mybatis分页插件pagehelper
    kaptcha验证码插件使用与参数
    redis主从简单配置
    从本地新建项目到提交到github
    Linux服务器安装rocketMQ单机消息队列
    Oracle通过命令导入数据存储文件
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/14874185.html
Copyright © 2011-2022 走看看