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

  1. /*---------------------------------------------------------------------------
  2.  * filename - dossftim.c
  3.  *
  4.  * function(s)
  5.  *        _dos_setftime - changes file date and time (MSC compatible)
  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 <_io.h>
  18. #include <dos.h>
  19.  
  20. /*--------------------------------------------------------------------------*
  21.  
  22. Name            _dos_setftime - gets file date and time
  23.  
  24. Usage           #include <dos.h>
  25.                 unsigned _dos_setftime(int handle, unsigned date,
  26.                                         unsigned time);
  27.  
  28. Related
  29. functions       _dos_getftime
  30.  
  31. Prototype in    dos.h
  32.  
  33. Description     _dos_setftime changes the file time and date for the
  34.                 disk file associated with the open handle to values in
  35.                 time and date.
  36.  
  37.                 Time bits       Meaning
  38.                 ---------       -------
  39.                 0-4             Number of 2-second increment (0-99)
  40.                 5-10            Minutes (0-59)
  41.                 11-15           Hours (0-23)
  42.  
  43.                 Date bits       Meaning
  44.                 ---------       -------
  45.                 0-4             Day (1-31)
  46.                 5-8             Month (1-12)
  47.                 9-15            Year (1980-2099)
  48.  
  49.  
  50. Return value    On success, 0 is returned.
  51.  
  52.                 In the event of an error return, the DOS error code
  53.                 is returned and the global variable errno is set to:
  54.  
  55.                         EBADF           Bad file number
  56.  
  57. *---------------------------------------------------------------------------*/
  58.  
  59. unsigned _dos_setftime(int fd, unsigned date, unsigned time)
  60. {
  61.     _AX = 0x5701;
  62.     _BX = fd;
  63.     _CX = time;
  64.     _DX = date;
  65.     geninterrupt(0x21);
  66.     if (_FLAGS & 1)                     /* if carry flag set, error */
  67.         return (__DOSerror(_AX));       /* set errno */
  68.     else
  69.         return (0);
  70. }
  71.