title: problems getting filedescriptor in c++
body: <p>I'm having problems with mapping a file into memory. I somehow can't get the Filedescriptor. This is what I try to do:</p>
  
  <pre><code>char* Logfile::open(){
  
      // get file size
      struct stat st;
      stat(name.c_str(), &amp;st);
  
      size = st.st_size;
  
      // get file descriptor
      file_descriptor = fstream::open(name.c_str(), fstream::flags = O_RDONLY); //open(name.c_str(), 0_RDONLY);
      if(file_descriptor &lt; 0){
          cerr &lt;&lt; "Error obtaining file descriptor for: " &lt;&lt; name.c_str() &lt;&lt; endl;
          return NULL;
      }
  
      // memory map part
      start = (char*) mmap(NULL, size, PROT_READ, MAP_SHARED, file_descriptor, 0);
      if(start == NULL){
          cerr &lt;&lt; "Error memory-mapping the file\n";
          //close(file_descriptor);
          return NULL;
      }
  
      return start;
  }
  </code></pre>
  
  <p>The Compiler keeps telling me:</p>
  
  <p>../src/Logfile.cpp: In member function ‘char* Logfile::open()’:
  ../src/Logfile.cpp:31: error: insufficient contextual information to determine type</p>