View Single Post
Old 26-01-2007, 07:34 AM   #13 (permalink)
ahref
eWebGuru
 
ahref's Avatar
 
Join Date: Mar 2006
Location: Dehradun
Posts: 427
Default Re: ASCII Code confusion

I have done slight modifications. now it is not storing function keys check it
Code:
#include<stdio.h>
#include<conio.h>
#include<dos.h>
void main()
{
int i=0;
char c='\0',s[50],d;
clrscr();
do
{
 c=getch();
 if(c>31 && c<127)
 {
  s[i]=c;
  i++;
  }
 else if(c==13)
 {
 s[i]='\0';
 printf("%s",s);
 }
 else              //or else if(c==0) both r ineffective
 {
  d=getch();
  sound(400);
  delay(50);
  nosound();
  }
 }while(c!=13);
getch();
}
__________________
Windows and linux hosting at http://www.ewebguru.com
Get $50 per blog post PM me for details.
ahref is offline