zoukankan      html  css  js  c++  java
  • 数据文件——将文本写入显示器设备文件

    代码:

     1 //This is c program code!
     2 /* *=+=+=+=+* *** *=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
     3   * 文档信息: *** :~/WORKM/stutyCode/cCode/recipesProblemSolution/chapter06/test6_22.c
     4   * 版权声明: *** :(魎魍魅魑)MIT
     5   * 联络信箱: *** :guochaoxxl@163.com
     6   * 创建时间: *** :2020年11月22日的下午02:37
     7   * 文档用途: *** :数据结构与算法分析-c语言描述
     8   * 作者信息: *** :guochaoxxl(http://cnblogs.com/guochaoxxl)
     9   * 修订时间: *** :2020年第46周 11月22日 星期日 下午02:37 (第327天)
    10   * 文件描述: *** :自行添加
    11  * *+=+=+=+=* *** *+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+*/
    12 #include <stdio.h>
    13 
    14 void closeState(FILE *fPtr){
    15     int clo = fclose(fPtr);
    16     if(clo == -1){ 
    17         puts("file-closing failed.");
    18     }
    19     if(clo == 0){
    20         puts("file-closing successfully.");
    21     }
    22 }
    23     
    24 int main(int argc, char **argv)
    25 {   
    26     FILE *fPtr = fopen("satara.txt", "r");
    27     if(fPtr != NULL){ 
    28         puts("Disk-file kolkata.txt opened successfully.");
    29         puts("It`s contents are now written to device file monitor: ");
    30         int ch = fgetc(fPtr);
    31     
    32         while(ch != EOF){
    33             fputc(ch, stdout);
    34             ch = fgetc(fPtr);
    35         }
    36         closeState(fPtr);
    37     }else{
    38         fprintf(stderr, "Disk-file opening failed
    ");
    39     }
    40                                                                                                                     
    41     return 0;
    42 }
  • 相关阅读:
    Kafka官方文档V2.7
    提交pr记录
    用Go语言来运行简单的hello world
    Mybatis学习记录-最简单的mybatis工程
    Flink CDC 实践记录
    CarbonDataDDL翻译003
    CarbonData使用案例
    CarbonData快速开始001
    如何构建数据仓库分层
    使用mybatis-plus的自动生成器生成代码
  • 原文地址:https://www.cnblogs.com/guochaoxxl/p/14054262.html
Copyright © 2011-2022 走看看