zoukankan      html  css  js  c++  java
  • 数据文件——将从键盘设备文件读取文本将其写入显示器设备文件

    代码:

     1 //This is c program code!
     2 /* *=+=+=+=+* *** *=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
     3   * 文档信息: *** :~/WORKM/stutyCode/cCode/recipesProblemSolution/chapter06/test6_23.c
     4   * 版权声明: *** :(魎魍魅魑)MIT
     5   * 联络信箱: *** :guochaoxxl@163.com
     6   * 创建时间: *** :2020年11月22日的下午02:48
     7   * 文档用途: *** :数据结构与算法分析-c语言描述
     8   * 作者信息: *** :guochaoxxl(http://cnblogs.com/guochaoxxl)
     9   * 修订时间: *** :2020年第46周 11月22日 星期日 下午02:48 (第327天)
    10   * 文件描述: *** :自行添加
    11  * *+=+=+=+=* *** *+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+*/
    12 #include <stdio.h>
    13 
    14 #define SIZE 500
    15     
    16 int main(int argc, char **argv)
    17 {       
    18     char text[SIZE];
    19     puts("Type the text. The text you type form the contents: ");
    20     puts("of the device-file keyboard. Strike the function");
    21     puts("ke F6 to signify the end of this file.");
    22 
    23     int size = 0;
    24     int ch = fgetc(stdin);
    25     while(ch != EOF){
    26         text[size] = ch;
    27         size = size + 1;
    28         ch = fgetc(stdin);
    29     }   
    30         
    31     puts("Contents of device-file keyboard are now:");
    32     puts("writtent to the device-file monitor:");
    33     for(int i = 0; i < size; i++){
    34         fputc(text[i], stdout);                                                                                     
    35     }   
    36         
    37     return 0;
    38 } 
  • 相关阅读:
    Android中手机录屏并转换GIF的两种方式
    Android中访问sdcard路径的几种方式
    Android中开发工具Android Studio修改created用户(windows环境)
    [UOJ211][UER #6]逃跑
    [CF1168D]Anagram Paths
    [CF852H]Bob and stages
    Codechef BINOMSUM
    [ZJOI2019]开关
    [CF1161F]Zigzag Game
    [CF1149E]Election Promises
  • 原文地址:https://www.cnblogs.com/guochaoxxl/p/14054297.html
Copyright © 2011-2022 走看看