  RMS shared file access in C++? 
 The Question is:
 
For OpenVMS DEC C++ 5.6 for VAX and DEC C++ 6.0 for ALPHA, using the CXX
compiler,  we want to have multiple processes write to a common log file
using standard cerr &lt;&lt;...  The answer to question 2867 about shared log
files was teasing, but I cant see how
 to get there from C++.
 
What is the C++ class interface to RMS?  I want to say something like the
'regular' C
fp = fopen( fn, "w", "shr=get,put,upd", "rat=cr", "rfm=var", "etx=rec");
 
and all I can find in the Alpha C++ on line class reference manuals is a
member function that takes a third integer, for example:
 
ofstream( const char* name, int mode, int prot ); where prot defaults to
openprot=0644 which is owner read write, group and world read.
 
 The Answer is:
#include &lt;fcntl.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;unistd.h&gt;
 
#include &lt;fstream.hxx&gt;
#include &lt;iostream.hxx&gt;
 
main ()
  {
  fstream outfile;
  int fd, pid = getpid();
 
  fd = open("fstream.log", O_CREAT|O_RDWR|O_APPEND, 0,
            "ctx=rec", "shr=get,put,upd");
  if ( fd == -1 )
    {
    // trap errors...
    perror("open");
    exit(EXIT_FAILURE);
    }
 
  outfile.attach(fd);
 
  if (outfile.fail())
    cout &lt;&lt; "Failed to open the file" &lt;&lt; endl;
 
  for (int i = 0; i &lt; 1000; ++i)
    outfile &lt;&lt; i &lt;&lt; ": One line for the file from: " &lt;&lt; pid &lt;&lt; endl;
 
  if (outfile.good())
    cout &lt;&lt; "No problem writing to file" &lt;&lt; endl;
 
  exit(EXIT_SUCCESS);
  }
 
