zoukankan      html  css  js  c++  java
  • conio.h (Console Input/Output 控制台输入输出)

    conio.h不是C标准库中的头文件。

    conio是Console Input/Output(控制台输入输出)的简写,其中定义了通过控制台进行数据输入和数据输出的函数,主要是一些用户通过按键盘产生的对应操作,比如getch()函数等等。
    包含的函数:
      cgets(char *);
      cprintf(const char *, ...);
      cputs(const char *);
      cscanf(const char *, ...);
      inp(unsigned short);
      inpw(unsigned short);
      getch(void);
      getche(void);
      kbhit(void);
      outp(unsigned short, int);
      outpw(unsigned short, unsigned short);
      putch(int);
      ungetch(int);
      void _Cdecl clreol (void);
      void _Cdecl clrscr (void);
      void _Cdecl delline (void);
      int _Cdecl gettext (int left, int top, int right, int bottom,
      void *destin);
      void _Cdecl gettextinfo (struct text_info *r);
      void _Cdecl gotoxy (int x, int y);
      void _Cdecl highvideo (void);
      void _Cdecl insline (void);
      void _Cdecl lowvideo (void);
      int _Cdecl movetext (int left, int top, int right, int bottom,
      int destleft, int desttop);
      void _Cdecl normvideo (void);
      int _Cdecl puttext (int left, int top, int right, int bottom,
      void *source);
      void _Cdecl textattr (int newattr);
      void _Cdecl textbackground (int newcolor);
      void _Cdecl textcolor (int newcolor);
      void _Cdecl textmode (int newmode);
      int _Cdecl wherex (void);
      int _Cdecl wherey (void);
      void _Cdecl window (int left, int top, int right, int bottom);
      char *_Cdecl cgets (char *str);
      int _Cdecl cprintf (const char *format, ...);
      int _Cdecl cputs (const char *str);
      int _Cdecl cscanf (const char *format, ...);
      int _Cdecl getch (void);
      int _Cdecl getche (void);
      char *_Cdecl getpass (const char *prompt);
      int _Cdecl kbhit (void);
      int _Cdecl putch (int c);
      int _Cdecl ungetch (int ch);
    编辑本段
    用法
    
      conio 库不仅适用于 Window 平台,在 Linux 下也可使用.网上已经有兼容包,下载后打开就可使用;而至于Mac则完全跟Window没有区别,直接可以使用.
    
    
    
    demo:
    #include "StdAfx.h"
    int main(int argc,char* argv[]){
    	/*
    	 函数名:kbhit()(VC++6.0下为_kbhit())
    	  功 能及返回值: 检查当前是否有键盘输入,若有则返回一个非0值,否则返回0
    	  用 法:int kbhit(void);
      包含头文件: include <conio.h>
    	*/
    	/*
    	cprintf("Press any key to continue.\n");
    	int i=0;
    	while( !(i=kbhit()) ){	
    		cprintf("\n no key pressed.");
    	}
    	printf("\nkbhit() return: %d.",i);
    
    	getch();
    */
    	//system("pause");
    
    	 //press one key to exit.
    	printf("press any to continue...\n");
    	char ch= getch();	
    	printf("you pressed %c.\n done\n",ch);
    	
    
    	/* //get environment variable
    	char * chPath = getenv("pathext");
    	printf("%s\n",chPath);
    
     	int i= getchar();
    	printf("%c",i);
    	*/
    	return 0;
    }
    

      

    
    
    
    
  • 相关阅读:
    windows下开启docker占用内存过高解决办法
    如何与别人共享Docker镜像
    使用docker部署springboot应用
    使用docker安装mysql5.7
    win10家庭版安装docker
    alibaba sentinel简单实践
    mysql函数GROUP_CONCAT()
    SVN同步时报错:“Previous operation has not finished; run 'cleanup' if it was interrupted”
    Eclipse从SVN检出maven项目后的一些配置
    完美解决 Uncaught SyntaxError: Unexpected token ‘<‘
  • 原文地址:https://www.cnblogs.com/wucg/p/2178862.html
Copyright © 2011-2022 走看看