title: opendir() failing on name with a space, running on linux
body: <p>My program explores the current directory and all sub directories to print all file names. However, it produces a segmentation fault when a directory has a space in its name. This only occurs on linux - windows it works fine.</p>
  
  <p>The name is stored in <code>dirent.d_name</code>, which is a <code>char[256]</code>. I have tried using it, converting it to a c-string using <code>c_str()</code>, I've tried hard coding the directory name into the code, I've tried escaping the space (although I don't think I'm doing it correctly).</p>
  
  <pre><code>int main()
  {
      struct dirent *direntry;
      dir = opendir( "hello\ world" );
      print_dir_rec( dir, direntry );
      return 0;
  }
  
  void print_dir_rec( DIR *dir, struct dirent *direntry )
  {
      while( direntry = readdir(dir) )
      {
          switch( direntry-&gt;d_type )
          {
              case DT_DIR:
                  DIR *sub_dir = opendir( direntry-&gt;d_name );
                  print_dir_rec( sub_dir , direntry );
                  break;
          }
      }
      return;
  }
  </code></pre>