Syntax
int SetEcho(
int echomode
);
Parameters
- echomode
-
[in] Specifies the echo mode state.
Value Description OFF Switches the echo mode off. ON Switches the echo mode on. CURRENT_MODE Does not change echo mode, but returns the current echo mode.
Return value
Returns the changed echo mode.
Remarks
When echo mode is on, the character is automatically displayed on the screen after a key press, without having to use putchar() or printf(). Note however, that the getchar() or kbhit() function must be called to display the character.
Only SetKeyinputMode(ORIGINAL_SHIFT_MODE) is supported.
Only SetKeyinputMode(ORIGINAL_SHIFT_MODE) is supported.
Requirements
Header file:
lib.hLibrary file:
libSTARTUPOPH5000.a
Sample
#include <stdio.h>
#include "lib.h"
void readln( char *string)
{
int c,x;
ResetKey();
for (x = 0 ;;)
{
switch( c = getchar() )
{
case EOF:
Idle();
break;
case ENT_KEY:
string[x] = '0';
return;
case BS_KEY:
if( x != 0)
{
x--;
string[x] = '0';
printf("\r%s ", string);
GotoXY( x, WhereY());
}
break;
default:
if( (c >= ' ') && (c < 0x80) && (x < 16))
string[x++] = (char)c;
break;
}
}
}
void main( void )
{
char string[20];
SetEcho( ON );
Cursor( BLINKING );
printf("\tr Echo test \tr\n");
for(;;)
{
readln(string);
printf("\n\tr%s\tr\n", string);
}
}
Last updated: 2022/04/08