home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / s / snip1292.zip / SHOWDATE.C < prev    next >
C/C++ Source or Header  |  1991-12-01  |  653b  |  31 lines

  1. /*
  2. ** SHOWDATE.C
  3. ** Syntax: SHOWDATE filename
  4. */
  5.  
  6. #include <dir.h>
  7. #include <io.h>
  8.  
  9. main(int argc, char *argv[])
  10. {
  11.     struct ffblk fb;
  12.     struct ftime *ft;
  13.  
  14.     /* Setup up ffblk */
  15.     if (argc < 2 ||
  16.         findfirst(argv[1],&fb,0))
  17.             exit();
  18.  
  19.     /* Map date & time into ftime structure using a typecast */
  20.     ft = (struct ftime *) &fb.ff_ftime;
  21.  
  22.     printf("Date: %02d-%02d-%02d   Time: %02d:%02d.%02d\n",
  23.         ft->ft_month,
  24.         ft->ft_day,
  25.         ft->ft_year+80,   /* Year - 1980 */
  26.         ft->ft_hour,
  27.         ft->ft_min,
  28.         ft->ft_tsec * 2); /* Seconds / 2 */
  29. }
  30. /* End of Program */
  31.