zoukankan      html  css  js  c++  java
  • Ubuntu使用Windows下的conio.h

    把虚线框里面的内容粘贴进文档文本里面

    ----------------------------------------------------------------------------------------------------------

    #include <termios.h>
    #include <stdio.h>


    static struct termios old, new;


    /* Initialize new terminal i/o settings */
    void initTermios(int echo) 
    {
      tcgetattr(0, &old); /* grab old terminal i/o settings */
      new = old; /* make new settings same as old settings */
      new.c_lflag &= ~ICANON; /* disable buffered i/o */
      new.c_lflag &= echo ? ECHO : ~ECHO; /* set echo mode */
      tcsetattr(0, TCSANOW, &new); /* use these new terminal i/o settings now */
    }


    /* Restore old terminal i/o settings */
    void resetTermios(void) 
    {
      tcsetattr(0, TCSANOW, &old);
    }


    /* Read 1 character - echo defines echo mode */
    char getch_(int echo) 
    {
      char ch;
      initTermios(echo);
      ch = getchar();
      resetTermios();
      return ch;
    }


    /* Read 1 character without echo */
    char getch(void) 
    {
      return getch_(0);
    }


    /* Read 1 character with echo */
    char getche(void) 
    {
      return getch_(1);
    }


    /* Let's test it out */

    ----------------------------------------------------------------------------------------------------

    另存为到          /usr/include/conio.h

  • 相关阅读:
    Axis2发布Webservice进行身份校验
    Spring集成Axis2
    分布式事务解决方案之TCC
    Lua 数据类型
    Lua 基本语法(1)
    Axis发布Webservice服务
    Linux中NFS服务器搭建
    SpringBoot多环境切换
    springboot中spring.profiles.include的妙用
    oracle树形语句
  • 原文地址:https://www.cnblogs.com/acbingo/p/4674388.html
Copyright © 2011-2022 走看看