peekb
raw OCR
Returns the byte of memory specified by segmentoffset.
Defined in header <dos.h>
Syntax
#include <dos.h>
char peekb(unsigned segment, unsigned offset);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ |
Remarks
peekb returns the byte at the memory location addressed by segmentxffset.
If peekb is called when dos.h has been included, it is treated as a macro that expands to inline code. If you don't include dos.h, or if you do include it and #undef peekb, you'll get the function rather than the macro.
Return value
peekb returns the byte of information stored at the memory location segmentioffset.
See also
Example
#include <stdio.h>
#include <conio.h>
#include <dos.h>
int main(void)
int value = 0;
printfC'The current status of your keyboard is:\n");
value = peekb(0x0040, 0x0017);
if (value & 1)
printf "Right shift on\n");
else
printf "Right shift off\n");
if (value & 2)
printf "Left shift on\n");
else
printf "Left shift off\n");
if (value & 4)
printf "Control key on\n");
else
printf "Control key off\n");
if (value & 8)
printf "Alt key on\n");
else
printf "Alt key off\n");
if (value & 16)
printf "Scroll lock on\n");
else
printf "Scroll lock off\n");
if (value & 32)
printf "Num lock on\n");
else
printf "Num lock off\n");
if (value & 64)
printfC'Caps lock on\n");
else
printfC'Caps lock off\n");
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/dos.h/peekb/
· short form /3.1/peekb/