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

  1. /*------------------------------------------------------------------*/
  2. /* ╡{ªí└╔ªW║┘: wat197.c                                             */
  3. /*------------------------------------------------------------------*/
  4. #include <io.h>
  5. #include <fcntl.h>
  6. #include <sys\stat.h>
  7. #include <process.h>
  8. #include <share.h>
  9. #include <stdio.h>
  10.  
  11. void main()
  12. {
  13.    int handle, status;
  14.    long length;
  15.  
  16.    handle = sopen("c:\\autoexec.bak",O_RDONLY,SH_DENYNO,S_IREAD);
  17.  
  18.    if (!handle)
  19.    {
  20.        printf("sopen() ¿τ╝╞░⌡ªµÑó▒╤\n");
  21.        exit(1);
  22.    }
  23.  
  24.    length = filelength(handle);
  25.    /* ┬Ω⌐w╛π¡╙└╔«╫ */
  26.    status = lock(handle,0L,length);
  27.  
  28.    if (status == 0)
  29.       printf("┬Ω⌐wª¿Ñ\\\n");
  30.    else
  31.       printf("┬Ω⌐wÑó▒╤\n");
  32.  
  33.    /* ▒N╛π¡╙└╔«╫╕╤┬Ω */
  34.    status = unlock(handle,0L,length);
  35.  
  36.    if (status == 0)
  37.       printf("╕╤┬Ωª¿Ñ\\\n");
  38.    else
  39.       printf("╕╤┬ΩÑó▒╤\n");
  40.  
  41.    close(handle);
  42. }
  43.