📄 libsdeb4.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="GENERATOR" content="Quadralay WebWorks Publisher Professional Edition 6.0.5">
<meta name="TEMPLATEBASE" content="book_html">
<meta name="LASTUPDATED" content="12/04/03 16:07:07">
<title>16.3 Keyboard and screen access</title>
<STYLE TYPE="text/css">
<!--
span.Signal { text-transform: uppercase; font-family: Verdana }
-->
</STYLE>
</head>
<body link="#3366CC" vlink="#9999CC" text="#000000" alink="#0000CC" bgcolor="#FFFFFF"
background="images/backgrnd.gif">
<p><img src="images/stlogo.gif" width="106" height="83" align="left"
alt="logo here!"> </p>
<table width="331" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td><a href="a_refman.htm"><img src="images/navtoc.gif" width="84" height="23"
border="0" alt="TOC"> </a></td>
<td><a href="libsdeb3.htm"><img src="images/navprev.gif" width="80" height="23"
border="0" alt="PREV"> </a></td>
<td><a href="libsdeb5.htm"><img src="images/navnext.gif" width="83" height="23"
border="0" alt="NEXT"> </a></td>
<td><a href="a_refmaa.htm"><img src="images/navidx.gif" width="84" height="23"
border="0" alt="INDEX"> </a></td>
</tr>
</table>
<p><br clear="all">
</p>
<hr align="left">
<blockquote>
<h2>
<a name="1204552"> </a><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">16.3 Keyboard and screen access</font>
</h2><hr>
<p>
<a name="1204554"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The application can send a message to the host screen using <font size=2 face=Courier><strong>debugmessage</strong></font>.</font>
</p>
<a name="1204555"> </a><font size=2 face=Courier><strong>debugmessage ("Hello World\n");<br></strong></font>
<p>
<a name="1204556"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The message is displayed in the window where the <strong>st20run</strong> command line was executed.</font>
</p>
<p>
<a name="1204558"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">A string can be read into a string buffer from the host keyboard using <font size=2 face=Courier><strong>debuggets</strong></font>. The string is terminated from the keyboard with a newline character, but the newline is replaced by a null character in the application string buffer. The function takes the maximum string size as a parameter, and the input is be truncated to this length if necessary. The function returns the actual number of characters read, including the terminating null character.</font>
</p>
<a name="1204559"> </a><font size=2 face=Courier><strong>#define MAX_STRING_SIZE 100<br><br></strong></font>
<a name="1204561"> </a><font size=2 face=Courier><strong>char buffer[MAX_STRING_SIZE];<br>long int num_bytes;<br>num_bytes = debuggets(buffer, MAX_STRING_SIZE);<br></strong></font>
<p>
<a name="1204563"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">Two functions enable a character to be read from the keyboard:</font>
</p>
<a name="1204564"> </a><font size=2 face=Courier><strong>long int debuggetkey(long int *buf);<br>long int debugpollkey(long int *buf);<br></strong></font>
<p>
<a name="1204566"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif"><font size=2 face=Courier><strong>debuggetkey</strong></font> returns the ASCII value of the character typed at the keyboard. The routine waits indefinitely for the next keystroke and only returns when a key is available. <font size=2 face=Courier><strong>debugpollkey</strong></font> polls the keyboard and returns the ASCII value of the key pressed.</font>
</p>
<p>
<a name="1204567"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">Due to an operating system limitation, the <font size=2 face=Courier><strong>ESC</strong></font> key cannot be polled on Windows<sup>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -