470,849 Members | 1,129 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

Int86 function in C

I recently came to know that using int86 function with interrupt number
22 we can identify keystrokes.
I want to know whether this is in any way different from getch()
function.
any help on this is much appreciated.

Mar 21 '06 #1
9 14485

Arun wrote:
I recently came to know that using int86 function with interrupt number
22 we can identify keystrokes.
I want to know whether this is in any way different from getch()
function.
any help on this is much appreciated.


[Posting once every minute does not hasten the responses (unless it's
Google playing up again, but it usualy does it thrice).]

Why not look into a standard `getchar()` function, which is guaranteed
to exist on any conforming implementation?

<OT>
It is different in a fundamental way. You stand a fighting chance that
`getch()`, although non-standard will be implemented in the next
incartnation of your compiler/library. Using interrupts locks you
completely to MS DOS platform.
</OT>

Mar 21 '06 #2
Arun wrote:
I recently came to know that using int86 function with interrupt number
22 we can identify keystrokes.
I want to know whether this is in any way different from getch()
function.
any help on this is much appreciated.


There is no 'int86' or getch() function in standard C. The latter
though is a common extension. For the former you probably meant INT 80h
interface to the Linux kernel? In any case, none of it is standard (and
hence portable) C, which is the topic for this newsgroup.

Mar 21 '06 #3
Vladimir S. Oka wrote:
Arun wrote:
I recently came to know that using int86 function with interrupt number
22 we can identify keystrokes.
I want to know whether this is in any way different from getch()
function.
any help on this is much appreciated.


[Posting once every minute does not hasten the responses (unless it's
Google playing up again, but it usualy does it thrice).]

Why not look into a standard `getchar()` function, which is guaranteed
to exist on any conforming implementation?

<OT>
It is different in a fundamental way. You stand a fighting chance that
`getch()`, although non-standard will be implemented in the next
incartnation of your compiler/library. Using interrupts locks you
completely to MS DOS platform.
</OT>


<OT>
Software interrupt based interfaces are also present in Linux and
Windows, though in the latter's case, they aren't really usable. It
depends on the Interrupt number. I think the OP means INT 80h for
Linux.
</OT>

Mar 21 '06 #4
On 21 Mar 2006 06:07:15 -0800, "santosh" <sa*********@gmail.com> wrote
in comp.lang.c:
Arun wrote:
I recently came to know that using int86 function with interrupt number
22 we can identify keystrokes.
I want to know whether this is in any way different from getch()
function.
any help on this is much appreciated.


There is no 'int86' or getch() function in standard C. The latter
though is a common extension. For the former you probably meant INT 80h
interface to the Linux kernel? In any case, none of it is standard (and
hence portable) C, which is the topic for this newsgroup.


Off topic, but no, he probably didn't mean the Linux system call
interrupt.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Mar 21 '06 #5
"santosh" <sa*********@gmail.com> writes:
Arun wrote:
I recently came to know that using int86 function with interrupt number
22 we can identify keystrokes.
I want to know whether this is in any way different from getch()
function.
any help on this is much appreciated.


There is no 'int86' or getch() function in standard C. The latter
though is a common extension. For the former you probably meant INT 80h
interface to the Linux kernel? In any case, none of it is standard (and
hence portable) C, which is the topic for this newsgroup.


Actually, getch() is several common extensions. There's a function by
that name in DOS and/or Windows, and another one in curses/ncurses
(which is mostly Unix-ish).

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Mar 21 '06 #6
Keith Thompson wrote:
"santosh" <sa*********@gmail.com> writes:
Arun wrote:
I recently came to know that using int86 function with interrupt number
22 we can identify keystrokes.
I want to know whether this is in any way different from getch()
function.
any help on this is much appreciated.


There is no 'int86' or getch() function in standard C. The latter
though is a common extension. For the former you probably meant INT 80h
interface to the Linux kernel? In any case, none of it is standard (and
hence portable) C, which is the topic for this newsgroup.


Actually, getch() is several common extensions. There's a function by
that name in DOS and/or Windows, and another one in curses/ncurses
(which is mostly Unix-ish).


Yes, along with getche() and others. That's what I said too. I have no
idea though about 'int86', whatever it may be, and it's differences
from getch(), which is what the OP wants to know.

Mar 21 '06 #7
Arun wrote:
I recently came to know that using int86 function with interrupt number
22 we can identify keystrokes.
I want to know whether this is in any way different from getch()
function.
any help on this is much appreciated.


<OT>
It depends on the implementation. In one system getch() might end up
calling the same code (BIOS?) as int86 with service no. 22 might. In
another system int86() may not even be available while getch() may be.
This is something you should not worry about to write programs.

In fact, sticking to pure ISO standard C is a good way to start out.
Then as your programming skill improves and you need platform specific
functionality, you can learn such specific stuff as the above.

Look up the description for getch() and int86() at the following URL.
If you absolutely need to know their implementation in DJGPP, you can
look up the sources, as it is Free Software.
http://www.delorie.com/djgpp/doc/libc/
</OT>

Finally, in future, please post only standard C related questions to
this group. Post platform specific questions like the above to their
respective groups like comp.os.msdos.djgpp. That way, you're assured of
the most relavent and accurate response.

Mar 21 '06 #8
int86() is a standard non-standard way of acessing the DOS and BIOS
API on a PC. It's possible to do things easily in DOS by using them. An
overly complete set of things you can do in such architectures is in
the Ralf Brown Interrupt list:

http://www.ctyme.com/rbrown.htm

There it says int 0x16 (22) is keyboard utilities.

Remember: use int86 and you'll be locked in that awful operating
system, FOREVER !!!
Hint: there's a curses version for DOS. It has getch() and much more !
http://pdcurses.sourceforge.net/
Hint 2: If you'd like to code more easily and faster, use a high level
language, with many built-in features, like Python or Ruby.

Henrique Dante de Almeida

Mar 22 '06 #9
hd****@gmail.com wrote:
int86() is a standard non-standard way of acessing the DOS and BIOS
API on a PC.

<rest snipped>

Thanks for the info, but can we end this highly off-topic thread now?

Mar 22 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by domeceo | last post: by
5 posts views Thread by phil_gg04 | last post: by
2 posts views Thread by laredotornado | last post: by
2 posts views Thread by sushil | last post: by
6 posts views Thread by os2 | last post: by
reply views Thread by Arun | last post: by
2 posts views Thread by Fredmanglis | last post: by
3 posts views Thread by abd elkader | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.