title: Getting GLE=5 (Access Denied ) Error While creating Named Pipe
body: <p>I have tried creating a named pipe but getting GLE 5 (access denied Error)</p>
  
  <pre><code>#include &lt;windows.h&gt; 
  #include &lt;stdio.h&gt;
  #include &lt;conio.h&gt;
  #include &lt;tchar.h&gt;
  #include "iostream.h"
  
  //#define PIPE_ACCESS_DUPLEX 0x00000003
  //#define PIPE_ACCESS_INBOUND 0x00000001
  //#define PIPE_ACCESS_OUTBOUND 0x00000002
  #define BUFSIZE 512
  
  int main()
  {
      HANDLE hPipe;
      LPTSTR lpszPipename = TEXT("\\\\.\\pipe\\mynamedpipe"); 
      hPipe=CreateNamedPipe(lpszPipename,PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,PIPE_UNLIMITED_INSTANCES,BUFSIZE,BUFSIZE,0,NULL);
  
      if (hPipe != INVALID_HANDLE_VALUE) 
          cout&lt;&lt;"Valid";
  
  
        if (GetLastError() != ERROR_PIPE_BUSY) 
        {
           printf( TEXT("Could not open pipe. GLE=%d\n"), GetLastError() ); 
           return -1;
        }
  
      return 0;
  }
  </code></pre>