home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a120 / 1.ddi / WATCOM_C / WAT72.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-18  |  1.4 KB  |  51 lines

  1. /*------------------------------------------------------------------*/
  2. /* ╡{ªí└╔ªW║┘: wat72.c                                              */
  3. /*------------------------------------------------------------------*/
  4. #include <sys\stat.h>
  5. #include <stdio.h>
  6. #include <time.h>
  7. #include <fcntl.h>
  8.  
  9. void main(int argc,char **argv)
  10. {
  11.  struct stat buf;
  12.  int handle;
  13.  
  14.  if(argc == 1)
  15.     printf("¿╧Ñ╬ñΦ¬k: wat72 <└╔«╫ªW║┘.¬■└╔ªW>\n");
  16.  else if(argc == 2)
  17.       {
  18.           /* ╢}▒╥ñ@¡╙└╔«╫ */
  19.           if ((handle = open(argv[1], O_RDONLY)) == -1)
  20.           {
  21.              fprintf(stderr, "╡L¬k╢}▒╥└╔«╫ %s  \n", argv[1]);
  22.              exit(1);
  23.           }
  24.  
  25.           /* ¿·▒oª╣└╔«╫ñº¼█├÷╕Ω░T */
  26.           fstat(handle, &buf);
  27.  
  28.           /* ┼πÑ▄│Q╢╟ª^ñº░T«º */
  29.           if (buf.st_mode & S_IFCHR)
  30.              printf("Ñ╪½eñº└╔«╫▒▒¿ε╜X½Y½ⁿªVñ@¡╙│]│╞.\n");
  31.  
  32.           if (buf.st_mode & S_IFREG)
  33.              printf("Ñ╪½eñº└╔«╫▒▒¿ε╜X½Y½ⁿªVñ@¡╙ñ@»δñº└╔«╫.\n");
  34.  
  35.           if (buf.st_mode & S_IREAD)
  36.              printf("╢╚ñ╣│\\¿╧Ñ╬¬╠┼¬¿·ª╣└╔«╫. \n");
  37.  
  38.           if (buf.st_mode & S_IWRITE)
  39.              printf("ñ╣│\\¿╧Ñ╬¬╠╝gñJª╣└╔«╫. \n");
  40.  
  41.           printf("ª╣└╔«╫⌐╥ªbñº║╧║╨ : %c\n", 'A'+buf.st_dev);
  42.  
  43.           printf("ª╣└╔«╫ñºñjñp(│µª∞:ª∞ñ╕▓╒) : %ld\n",buf.st_size);
  44.  
  45.           printf("ª╣└╔«╫│╠½ßñ@ª╕│Q¡╫º∩ñº«╔╢í : %s\n",ctime(&buf.st_ctime));
  46.  
  47.           /* ├÷│¼ª╣└╔«╫ */
  48.           close(handle);
  49.        }
  50. }
  51.