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

  1. /*------------------------------------------------------------------*/
  2. /* ╡{ªí└╔ªW║┘: wat108.c                                             */
  3. /*------------------------------------------------------------------*/
  4. #include <io.h>
  5. #include <fcntl.h>
  6. #include <stdio.h>
  7.  
  8. void main()
  9. {
  10.    int handle, lock_stat;
  11.    long size;
  12.  
  13.    handle = open("c:\\autoexec.bat",
  14.       O_RDONLY|O_TEXT);
  15.  
  16.    if (handle == -1)
  17.    {
  18.       printf("open() ¿τ╝╞╢}└╔Ñó▒╤\n");
  19.       exit(1);
  20.    }
  21.  
  22.    size = filelength(handle);
  23.    lock_stat = lock(handle,0L,size/2);
  24.  
  25.    if (lock_stat == 0)
  26.       printf("ª¿Ñ\ªa┬Ω⌐w\n");
  27.    else
  28.       printf("┬Ω⌐wÑó▒╤\n");
  29.  
  30.    lock_stat = unlock(handle,0L,size/2);
  31.  
  32.    if (lock_stat == 0)
  33.       printf("ª¿Ñ\ªa╕╤┬Ω\n");
  34.    else
  35.       printf("╕╤┬ΩÑó▒╤\n");
  36.  
  37.    close(handle);
  38. }
  39.