Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>peek</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
peek

Usage

   #include <dos.h>
   void peek(unsigned seg,unsigned offset,void *buf, int
   numbytes);

Description

   Moves numbytes from the memory specified by seg:offset to the buffer
   pointed to by buf.

Example

   /* this program will accept as command line arguments

       ON or OFF - to turn numlock on or off. */

   #include <stdio.h>
   #include <dos.h>
   #include <string.h>
   #include <stdlib.h>

   int main(int argc,char *argv[])
   {
       char state1,state2;
       int i;
       for( i = 0; i < argc; i++)
           {
               strupr(argv[i]);
           }
       if( (strcmp(argv[1],"ON") == 0))
           {
               printf("Numlock is on\n");
               peek(0,0x417,&state1,1);
               state1 |= 0x20;

               poke(0,0x417,&state1,1);
           }
       else
           if( (strcmp(argv[1],"OFF") == 0 ))
               {
                   printf("Numlock is off\n");
                   peek(0,0x417,&state1,1);
                   state1 &= ~0x20;
                   poke(0,0x417,&state1,1);
               }
           else
               {
                   printf("\nEnter ON or OFF as a command);
                   printf(" line argument\n");
                   exit(EXIT_FAILURE);
               }
       return EXIT_SUCCESS;
   }

See Also

   poke



See Also: poke

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson