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

时间: 2025-01-15 08:30:39

Ubuntu使用Windows下的conio.h的相关文章

Linux 下没有conio.h 已解决

原文:http://blog.sina.com.cn/s/blog_6a95e00b0100zqvf.html #include <stdio.h>//#include <conio.h> void main(){    char ch;    for(;;){//        system("stty -echo");        ch = getch();                if(ch==27) break;            if(ch

Ubuntu和windows下修改hosts

首先,提供一个hosts文件 http://pan.baidu.com/s/1jGMptxO ubuntu 下载好了这个文件后,用gedit打开,复制里面所有内容,然后打开终端,输入 `sudo gedit /etc/hosts` 提示输入密码后,将复制的内容粘贴到原有的内容后面,保存,然后输入 sudo /etc/init.d/networking restart重启网络就好了 接着打开浏览器,打开google,能正常访问就ok了 windows 打开c盘,windows>>system32

ubuntu在windows下的wubi安装

转自:http://mp.weixin.qq.com/s?__biz=MjM5NjYxNjU0OQ==&mid=200664819&idx=2&sn=25719890570b196a032f62c2dd3802bc&3rd=MzA3MDU4NTYzMw==&scene=6#rd 工具/原料 镜像:ubuntu-14.04-desktop-amd64.iso 工具:wubi.exe 工具:RAR 方法/步骤 1 使用RAR打开ubuntu-14.04-desktop-

winconsio.h:一个用于在windows平台替代conio.h的自用库

1 #ifndef WIN_CONS_IO_H 2 #define WIN_CONS_IO_H 3 4 #include <windows.h> 5 6 #define SetConsColor(colorIndex) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), colorIndex) 7 #define BeginFGRed SetConsColor(FOREGROUND_RED) 8 #define BeginFGBlu

ubuntu和Windows 下的GIF动图工具

目录 Ubuntu16.04 安装 SimpleScreenRecorder Windows 安装 ScreenToGif 官网地址:https://www.screentogif.com/?l=zh_cn Ubuntu16.04 安装 SimpleScreenRecorder sudo add-apt-repository ppa:maarten-baert/simplescreenrecorder sudo apt-get update sudo apt-get install simple

Ubuntu上安装和使用SSH,Xming+PuTTY在Windows下远程Linux主机使用图形界面的程序

自:http://blog.csdn.net/neofung/article/details/6574002 Ubuntu上安装和使用SSH  网上有很多介绍在Ubuntu下开启SSH服务的文章,但大多数介绍的方法测试后都不太理想,均不能实现远程登录到Ubuntu上,最后分析原因是都没有真正开启ssh-server服务.最终成功的方法如下: Ubuntu 下安装 OpenSSH Server 是无比轻松的一件事情,需要的命令只有一条: sudo apt-get install openssh-s

挂载windows下的共享文件到ubuntu

一直都是ubuntu通过samba共享文件到windows下,那ubutnu下该如何挂载windows共享的文件呢? 是时候mount命令上场了! 将windows上的Workspace 文件夹挂载到mnt目录下,并且文件及文件夹的权限都是0777: sudo mount.cifs //192.168.1.112/Workspace mnt/ -o user=lcg,pass=123456,file_mode=0777,dir_mode=0777 来看下成果: windows下: ubutnu下

Windows下Putty连接虚拟机Ubuntu

本文的题目是Windows下使用Putty连接虚拟机中的Ubuntu. 其实针对这样的一个问题,已经有很多的文章,blog可以参考和学习,但是在本人的学习过程中还是遇到可很多的问题.特写下自己的整个解决问题的过程. 首先Putty是一个很轻的工具,直接下载,几乎不用安装,单击打开,填入信息便可以登录到虚拟机中的Ubuntu中. 需要解决的问题一:Ubuntu需要安装Openssh. 在Terminal下, sudo apt-get isatall openssh-server 便可.这里安装完,

windows下putty无法连接虚拟机Ubuntu

Windows下实现远程用Putty登录管理Ubuntu,或者登录虚拟机中的Ubuntu登录不上的解决方案. 1.先明确你能ping通远程的Ubuntu或者虚拟机. 2.如果还不能登录,分析原因是大多都没有真正开启ssh-server服务.最终成功的方法如下: sudo apt-get install openssh-server Ubuntu缺省安装了openssh-client,所以在这里就不安装了,如果你的系统没有安装的话,再用apt-get安装上即可. 然后确认sshserver是否启动