Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > send me the solution.

Reply
Thread Tools

send me the solution.

 
 
wahid
Guest
Posts: n/a
 
      01-10-2010
Using getch() command, write a program that
will echo user key strokes onto the screen, and
if the user presses a letter (A-Z, a-z), the
echoed character will always be a capital
letter. The program terminates when the user
presses the ESC key

(Hint, ASCII code for ESC is 27, for A is 65, and
for a is 97. the values are given in decimal
notation)
 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      01-10-2010
wahid wrote:
> Using getch() command, write a program that


C doesn't have a "getch() command".

Are you incapable of doing anything for your self?

--
Ian Collins
 
Reply With Quote
 
 
 
 
Antoninus Twink
Guest
Posts: n/a
 
      01-10-2010
On 10 Jan 2010 at 7:06, wahid wrote:
> • Using getch() command, write a program that will echo user key
> strokes onto the screen, and if the user presses a letter (A-Z, a-z),
> the echoed character will always be a capital letter. The program
> terminates when the user presses the ESC key


#include <stdio.h>
#include <ctype.h>
#include <curses.h>

#define KEY_ESC 27

int main(void)
{
int c, rv = 0;
if(initscr() && cbreak() == OK && noecho() == OK) {
printw("(escape to exit)\n");
refresh();
while((c = getch()) != KEY_ESC) {
printw("%c", toupper(c));
refresh();
}
if(endwin() == ERR)
rv = 1;
} else
rv = 1;
return rv;
}

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Socket send functions only allow you to send strings? Ryan Parmeter Ruby 4 09-05-2007 03:29 AM
Mail.SmtpMail.Send won't send to one of my addresses Nathan Sokalski ASP .Net 3 11-23-2005 09:25 PM
Pre-Send Request Headers, Pre-Send Request Content =?Utf-8?B?S2V2aW4gQnVydG9u?= ASP .Net 0 12-31-2004 06:29 PM
Send command around network =?Utf-8?B?UG9wZXll?= Wireless Networking 0 08-18-2004 07:13 AM
Does Socket.send send all bytes? Chris Reay Ruby 2 11-04-2003 08:22 PM



Advertisments