Sree opined:
Hello Friends,
i was trying to read the Keyboard typeahead buffer from BIOS
according to its address.
But i'm not able to get the data.
Please tell me how to do so.
You're missing at least some #include files:
/* for `printf()` */
#include <stdio.h>
and (I may be wrong here):
/* for non-Standard stuff */
#include <conio.h>
void main()
This should be:
int main(void)
or
int main(int argc, char *argv[])
{
char far *p=(char* far)(0x0040001E);
int i=0;
No need to initialise here, as you do it below anyway.
clrscr();
Why does everybody seem to want to clear the screen for no good reason
whatsoever?
for(i=0;i<32;i++)
printf("\n%4d %c",(*(p+i)),*(p+i));
You need to terminate `printf()` with a '\n' (or do a `fflush(stdout)`)
if you want to be sure anything (on the last line) is displayed.
getch();
There's a perfectly standard `getchar()` for this (it may require you
to press ENTER as well, though).
}
i tried using a "near" pointer too. But not working!
What exactly is not working?
The above shouldn't compile at all (see my comments), but I guess you
just did not get the numbers you expected.
Anyway, your question is system specific (DOS I believe), an here we
discuss only standard C, so you're much better off asking elsewhere.
comp.os.msdos.programming
may be a good starting place.
--
if (argc > 1 && strcmp(argv[1], "-advice") == 0) {
printf("Don't Panic!\n");
exit(42);
}
(Arnold Robbins in the LJ of February '95, describing RCS)
<http://clc-wiki.net/wiki/Introduction_to_comp.lang.c>