Echo on and off
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Echo on and off




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Echo on and off  
keith@bytebrothers.co.uk


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-26-07 12:17 PM


Hi all,

Is there some portable (OS-independent?) way of turning echo on and
off for a terminal device?  At the moment I have something similar to
the following for Un*x, but of course I can't use this with DJGPP in a
'DOS' console program.

#include <termios.h>

static int setnoecho (struct termios *t)
{
if (isatty (STDIN_FILENO) == 0)
{
fprintf(stderr, "Device is not a TTY.\n");
return(-1);
}

if (tcgetattr (STDIN_FILENO, t) < 0)
{
fprintf(stderr, "tcgetattr() failed.\n");
return(-1);
}

t->c_lflag &= ~ECHO;
tcsetattr (STDIN_FILENO, TCSANOW, t);
return (0);
}

static void setecho (struct termios *t)
{
t->c_lflag |= ECHO;
tcsetattr (STDIN_FILENO, TCSANOW, t);
}






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 04:51 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register