| Forum |
|
|||||||
| Programming The destination for developers - C, C++, Java, Python and the lot |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Super Hero - Super Powers
Join Date: Sep 2006
Location: Dynamic
Posts: 766
|
Code:
ASCII Code Key-1 Key-2
59 ; F1
60 < F2
. = .
. > .
. ? .
. @ .
. A .
. B .
. C .
68 D F10
71 Home G
82 Insert R
etc.
__________________
Minds are like Parachutes |
|
|
| Advertisements. Register and be a member of the community to get rid of them. | |
|
Advertisement
|
|
|
|
#3 (permalink) | |
|
Super Hero - Super Powers
Join Date: Sep 2006
Location: Dynamic
Posts: 766
|
Quote:
__________________
Minds are like Parachutes |
|
|
|
|
|
#4 (permalink) |
|
eWebGuru
Join Date: Mar 2006
Location: Dehradun
Posts: 427
|
For key-2, you have to press ctrl key means programatically you have to enable control key, which you can do by modifying memory address 0x417.
__________________
Windows and linux hosting at http://www.ewebguru.com Get $50 per blog post PM me for details. |
|
|
|
|
#5 (permalink) | |
|
Super Hero - Super Powers
Join Date: Sep 2006
Location: Dynamic
Posts: 766
|
Quote:
__________________
Minds are like Parachutes |
|
|
|
|
|
#6 (permalink) |
|
eWebGuru
Join Date: Mar 2006
Location: Dehradun
Posts: 427
|
check this program
void main() { char x,y,z; clrscr(); printf("Press any key"); x=getch(); if(x==0) { y=getch(); printf("\nExtended Ascii code is %d",y); } else { printf("\nAscii Code is %d",x); } getch(); }
__________________
Windows and linux hosting at http://www.ewebguru.com Get $50 per blog post PM me for details. |
|
|
|
|
#7 (permalink) |
|
Super Hero - Super Powers
Join Date: Sep 2006
Location: Dynamic
Posts: 766
|
Still facing the problem.
Look at this Code:
void main()
{
...
char x;
x=getch();
if(x==59)
pf("x = %d",x);
else
pf("\a");
...
....
}
Code:
ASCII Code Key-1 Key-2
59 ; F1
60 < F2
. = .
. > .
. ? .
. @ .
. A .
. B .
. C .
68 D F10
71 Home G
82 Insert R
etc.
That's why I asked to distinguish btwn keys.
__________________
Minds are like Parachutes |
|
|
|
|
#8 (permalink) |
|
eWebGuru
Join Date: Mar 2006
Location: Dehradun
Posts: 427
|
void main()
{ char x,y,z; clrscr(); printf("Press any key"); x=getch(); if(x==0) { y=getch(); printf("\a"); printf("\nExtended Ascii code is %d",y); } else { printf("\nAscii Code is %d",x); } getch(); }
__________________
Windows and linux hosting at http://www.ewebguru.com Get $50 per blog post PM me for details. |
|
|
|
|
#9 (permalink) | |
|
Super Hero - Super Powers
Join Date: Sep 2006
Location: Dynamic
Posts: 766
|
Quote:
Code:
if(x==0)
{
y=getch();
printf("\a");
printf("\nExtended Ascii code is %d",y);
}
__________________
Minds are like Parachutes |
|
|
|
|
|
#10 (permalink) |
|
eWebGuru
Join Date: Mar 2006
Location: Dehradun
Posts: 427
|
That code should execute when you press F1,F2 key etc. It is working fine in my end. Probably you have to flush your keyboard buffer.
__________________
Windows and linux hosting at http://www.ewebguru.com Get $50 per blog post PM me for details. |
|
|
|
|
#11 (permalink) |
|
Super Hero - Super Powers
Join Date: Sep 2006
Location: Dynamic
Posts: 766
|
OK ahref. Unfortunately your trick doesn't work on my system but I have solved my prob by modifying the program code.
Anyway, thx a lot for ur help. Ur trick added a new idea in my programming knowledge.
__________________
Minds are like Parachutes |
|
|
|
|
#12 (permalink) |
|
Super Hero - Super Powers
Join Date: Sep 2006
Location: Dynamic
Posts: 766
|
Now a new prob. in another program.
Take a look at this prog. Code:
#include<stdio.h>
#include<conio.h>
#include<dos.h>
void main()
{
int i=0;
char c='\0',s[50];
clrscr();
do
{
c=getch();
if(c>31 && c<127)
{
s[i]=c;
i++;
}
else if(c==13)
printf("%s",s);
else //or else if(c==0) both r ineffective
{
sound(400);
delay(50);
nosound();
}
}while(c!=13);
getch();
}
I want that F1, F2.... etc. keys must not b stored in string. How can I do that?
__________________
Minds are like Parachutes |
|
|
|
|
#13 (permalink) |
|
eWebGuru
Join Date: Mar 2006
Location: Dehradun
Posts: 427
|
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. |
|
|
|
|
#14 (permalink) |
|
Super Hero - Super Powers
Join Date: Sep 2006
Location: Dynamic
Posts: 766
|
OK ahref. Thx a lot for ur help.
Ur slight modification made a big difference. I don't know that why that idea doesn't came in my mind Anyway, thx again & repu for u.
__________________
Minds are like Parachutes |
|
|
|
|
#16 (permalink) | |
|
Super Hero - Super Powers
Join Date: Sep 2006
Location: Dynamic
Posts: 766
|
Quote:
THE WAITE GROUP'S Writer - ROBERT LAFOREOBJECT ORIENTED PROGRAMMING IN TURBO C++ Publishers - Galgotia Publicators Pvt. Ltd., 5, Ansari Road, Daryaganj, New Delhi Price - 350 Rs.
__________________
Minds are like Parachutes Last edited by n2casey; 26-01-2007 at 01:52 PM. |
|
|
|
|
|
#19 (permalink) | |
|
Super Hero - Super Powers
Join Date: Sep 2006
Location: Dynamic
Posts: 766
|
Quote:
The book I have told U is recommended by Univ. for OOP in C++. In First yr I read Let Us C or C++ by Yashwant Kanitker to learn C from beginning. In third yr I read the book THE WAITE GROUP'S OBJECT ORIENTED PROGRAMMING IN TURBO C++ Writer - ROBERT LAFORE & that time I come to know that it covers all topic in detail with very ease & lot of exapmles. Let Us C/C++ both the books r good for beginners & easy too but will not cover all topics & so I told u to read OOP in Turbo C++ by Robert Lafore.
__________________
Minds are like Parachutes |
|
|
|
|
|
#21 (permalink) | |
|
Super Hero - Super Powers
Join Date: Sep 2006
Location: Dynamic
Posts: 766
|
Quote:
I was reading from my friend's book for last 2 yrs but now I have my own. Well I suggest u to get one year old edition coz I don't found more changes in the book in last one year. This link might help u
__________________
Minds are like Parachutes Last edited by n2casey; 29-01-2007 at 11:28 PM. |
|
|
|
|
|
#22 (permalink) |
|
Human Spambot
Join Date: Feb 2004
Location: Mumbai
Posts: 2,653
|
I have a header file for all these key-codes.
So insted of 0x1b you can use ESC for escape key. Have a look at http://www.mailnspace.com/download/c.source/
__________________
:: Free hosting and free domain names available in special cases. Conditions apply :: |
|
|
|
|
#24 (permalink) | |
|
Human Spambot
Join Date: Feb 2004
Location: Mumbai
Posts: 2,653
|
Quote:
BTW, any more reps for writing that C code? Each line of code in the files offerred there is written by me!
__________________
:: Free hosting and free domain names available in special cases. Conditions apply :: |
|
|
|
|
|
#25 (permalink) |
|
Google Bot
Join Date: Aug 2005
Posts: 9,751
|
@n2casey n others...
i saw the book oops in turbo c++ and also Oops in C++ by the same author- r lafore....... wich is better??? @ tuxfan can u also recommend some good book on c++ wich covers all the advanced topics.... |
|
|
|
|
#26 (permalink) | |
|
Super Hero - Super Powers
Join Date: Sep 2006
Location: Dynamic
Posts: 766
|
Quote:
Also it will cover many advanced topics. It's a good book for both beginners & advance programmers. One suggestion for u, use the term OOP (Object Oriented Programming) instead of OOPs.
__________________
Minds are like Parachutes |
|
|
|
|
|
#27 (permalink) |
|
Human Spambot
Join Date: Feb 2004
Location: Mumbai
Posts: 2,653
|
I really have no idea on books on C++. But I have read Yashwant Kanetkar's Let Us C, Pointers in C, etc. and they were good. There is also a book called Let Us C++ by the same author.
I have also read his columns in newspapers, magazines, etc. and know that he is a knowledgeable person who writes well. Try his book.
__________________
:: Free hosting and free domain names available in special cases. Conditions apply :: |
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|