⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keypad.c

📁 一个C格式的脚本处理函数库源代码,可让你的C程序具有执行C格式的脚本文件
💻 C
字号:
/* This routine illustrates the keypad interface.  To implement * detection of a single escape character, allow for timeout. */#include <stdio.h>#include <slang.h>#include "demolib.c"#define TIMEOUT 2		       /* 2/10 of a second */static int getch (void){   int ch;      while (0 == SLang_input_pending (1000))     continue;      ch = SLang_getkey ();    if (ch == 033)		       /* escape */     {	if (0 == SLang_input_pending (TIMEOUT))	  return 033;     }      SLang_ungetkey (ch);      return SLkp_getkey ();}int main (int argc, char **argv){   int ch;   (void) argc; (void) argv;   if (-1 == demolib_init_terminal (1, 0))     return 1;   fprintf (stderr, "This program illustrates the slkeypad facility.\n");   fprintf (stderr, "Press any key ('q' quits).\n");   while ('q' != (ch = getch ()))     {	fprintf (stderr, "Keysym: %d\r\n", ch);     }      demolib_exit (0);      return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -