home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 1.ddi / CLIBSRC1.ZIP / SOPEN.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.6 KB  |  55 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - sopen.c
  3.  *
  4.  * function(s)
  5.  *        sopen         - open a file for file sharing (MSC compatible)
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #define __IN_SOPEN
  18.  
  19. #include <stdio.h>
  20. #include <io.h>
  21. #include <fcntl.h>
  22.  
  23. /*-----------------------------------------------------------------------*
  24.  
  25. Name            sopen - opens a file for file sharing
  26.  
  27. Usage           #include <fcntl.h>
  28.                 #include <sys\stat.h>
  29.                 #include <share.h>
  30.                 #include <io.h>
  31.  
  32.                 int sopen(const char *pathname, int access, int shflag
  33.                           [, unsigned permiss] );
  34.  
  35. Prototype in    io.h
  36.  
  37. Description     Similar to open, except that it has an extra parameter shflag,
  38.                 which specifies the file sharing mode.  This sharing mode
  39.                 can be one of the constants defined in share.h; see the
  40.                 sopen documention for a complete description.
  41. *------------------------------------------------------------------------*/
  42. /* sopen declared old style since prototype has ... */
  43.  
  44. int  sopen(pathP, oflag, shflag, mode)
  45. const char *pathP;
  46. int oflag;
  47. int shflag;
  48. unsigned mode;  /* optional -- only used when oflag contains O_CREAT */
  49. {
  50.     if (oflag & O_CREAT)
  51.         return (open(pathP, oflag|shflag, mode));
  52.     else
  53.         return (open(pathP, oflag|shflag));
  54. }
  55.