home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a120 / 1.ddi / WATCOM_C / WAT48.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-16  |  925 b   |  37 lines

  1. /*------------------------------------------------------------------*/
  2. /* ╡{ªí└╔ªW║┘: wat48.c                                              */
  3. /*------------------------------------------------------------------*/
  4. #include <stdio.h>
  5. #include <dos.h>
  6.  
  7. void main()
  8. {
  9.  int handle;
  10.  char buffer[11] = "abcdefghij";
  11.  
  12.  if (_dos_creat("MYFILE.TXT",_A_NORMAL,&handle) == 0)
  13.  {
  14.    write(handle,buffer,strlen(buffer));
  15.    show_attribute();
  16.    _dos_setfileattr("MYFILE.TXT",_A_RDONLY);
  17.    show_attribute();
  18.    _dos_close(handle);
  19.  }
  20.  else
  21.   printf("╡L¬k½╪Ñ▀ª╣└╔«╫\n");
  22. }
  23.  
  24. show_attribute()
  25. {
  26.  unsigned attr;
  27.  
  28.  _dos_getfileattr("MYFILE.TXT",&attr);
  29.  printf("└╔«╫ MYFILE.TXT ñº─▌⌐╩¼░ %d\n",attr);
  30.  if (attr & _A_NORMAL)
  31.          printf("ª╣└╔«╫¼Oñ@¡╙Ñi┼¬ÑBÑi╝gñº└╔«╫\n");
  32.  else if (attr & _A_RDONLY)
  33.          printf("ª╣└╔«╫¼Oñ@¡╙░▀┼¬└╔«╫\n");
  34.  else
  35.          printf("ª╣└╔«╫ñú¼Oñ@¡╙Ñi┼¬ÑBÑi╝gñº└╔«╫\n");
  36. }
  37.