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;
    }
  • 相关阅读:
    orale 函数大全[转] 涛
    easyuicombobox的option选项为true与false时的问题 涛
    数据库镜像转移Failover Partner 涛
    创建链接服务器 涛
    Sql Server 2008 R2 清空数据库中ldf日志文件 涛
    杂 涛
    Jquery 数组操作大全【转载】 涛
    VS2012常用快捷键 涛
    android studio集成ijkplayer Vevi
    CenOs 部署记录 Vevi
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/14874185.html
Copyright © 2011-2022 走看看