home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 1.ddi / CLIBSRC1.ZIP / DOSKEEP.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.6 KB  |  53 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - doskeep.c
  3.  *
  4.  * function(s)
  5.  *        _dos_keep - exits and remains resident
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1991, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #include <dos.h>
  18. #include <process.h>
  19.  
  20. /*---------------------------------------------------------------------*
  21.  
  22. Name            _dos_keep - exits and remains resident
  23.  
  24. Usage           void _dos_keep(unsigned status, unsigned size);
  25.  
  26. Prototype in    dos.h
  27.  
  28. Description     _dos_keep returns to MS-DOS with the exit status in
  29.                 status. The current program remains resident, however. The
  30.                 program is set to size paragraphs in length, and the
  31.                 remainder of the memory of the program is freed.
  32.  
  33.                 _dos_keep does the same cleanup as _cexit.  It flushes
  34.                 files, calls atexit and #pragma exit routines, and
  35.                 restores interrupt vectors taken by the library.
  36.                 It does not close files; the caller must explicitly
  37.                 close any open files, if necessary.
  38.  
  39.                 _dos_keep can be used when installing a TSR program.
  40.                 _dos_keep uses DOS function 0x31.
  41.  
  42. Return value    None
  43.  
  44. *---------------------------------------------------------------------*/
  45. void _dos_keep(unsigned char status, unsigned size)
  46. {
  47.         _cexit();
  48.         _DX = size;
  49.         _AL = status;
  50.         _AH = 0x31;
  51.         geninterrupt(0x21);
  52. }
  53.