home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / LIBSRC.ZOO / libsrc / local / pipe.c < prev    next >
Text File  |  1992-02-16  |  474b  |  28 lines

  1. #define INCL_DOSQUEUES
  2. #define INCL_DOSERRORS
  3. #include <os2.h>
  4. #include <errno.h>
  5.  
  6. ULONG Dos32CreatePipe() asm ("Dos32CreatePipe");
  7.  
  8. int pipe (int *fildes)
  9. {
  10.    ULONG rc;
  11.    HFILE ReadHandle;
  12.    HFILE WriteHandle;
  13.  
  14.    rc = Dos32CreatePipe (&ReadHandle, &WriteHandle, 0);
  15.  
  16.    if (rc == ERROR_NOT_ENOUGH_MEMORY)
  17.    {
  18.       errno = EFAULT;
  19.       return (-1);
  20.    }
  21.  
  22.    fildes[0] = (int)ReadHandle;
  23.    fildes[1] = (int)WriteHandle;
  24.  
  25.    return (0);
  26. }
  27.  
  28.