home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / S12362.ZIP / REBOOT.C < prev    next >
C/C++ Source or Header  |  1989-05-12  |  1KB  |  32 lines

  1. #define INCL_BASE
  2.  
  3. #include <os2.h>
  4.  
  5. #include <stdio.h>
  6. #include <conio.h>
  7.  
  8. void main(void);
  9.  
  10. void main(void)
  11. {
  12.    HFILE hf;
  13.    USHORT usAction,retcode;
  14.  
  15.    printf("\n Hit a key to reboot...");
  16.    getch();
  17.    retcode = DosOpen("REBOOT$",                /* open reboot device  */
  18.        &hf,                                    /* address of device handle */
  19.        &usAction,                              /* action taken */
  20.        0L,                                     /* size of new file */
  21.        0,                                      /* normal file attribute */
  22.        1,                                      /* open existing file */
  23.        0x0011,                                 /* write-only, exclusive */
  24.        0L);                                    /* reserved */
  25.  
  26.    if (!retcode)
  27.       DosDevIOCtl(0L,0L,0,0,hf);         /* pass user IOCtl Cat 80h */
  28.                                                /* Func 41h */
  29.    else
  30.       printf("\n DosOpen on REBOOT$ failed... rc = %u\n",retcode);
  31. }
  32.