title: Error at line 0, column 0: bad conversion while loading YAML file
body: <p>Below is the yaml sample file which I have already validated through YAMLint
  URL but while loading this file with yaml-cpp library function <code>LoadFile</code>, I am getting error:</p>
  
  <blockquote>
    <p>"Error at line 0, column 0: bad conversion while loading YAML file"</p>
  </blockquote>
  
  <h2>sample yaml file:</h2>
  
  <pre><code>%YAML 1.1
  ---
  name: abcd_server_interface
  spec_type: interface
  spec_version: 1
  description: 'Interface for capability ABCD Slam'
  default_provider: abcd_server/abcd_server_provider
  interface: {}
  topics: {
       provides: {
  
         provide: {
         name: '/3d_pose_graph',
         type: '-',
         description: '-',
         },
  
         provide: {
         name: '/key_frame_msgs',
         type: '-',
         description: '-'
           }, 
  
         provide: {
         name: '/pc_map',
         type: 'sensor_msgs/PointCloud2',
         description: 'Point cloud'
           },
  
         provide: {
         name: '/3dOctomap',
         type: '-',
         description: '-'
           },
  
         provide: {
         name: '/poseOfRobots',
         type: '-',
         description: '-'
           },
  
         provide: {
         name: '/occupied_calls_vis_array',
         type: '-',
         description: '-'
           },
       },    
       requires: {
  
        require: {
         name: '/image_depth_throttled',
         type: 'sensor_msgs/Image',
         description: 'Sensor Image',
         },
  
         require: {
         name: '/image_color_throttled/compressed',
         type: 'sensor_msgs/CompressedImage',
         description: 'Sensor compressed image',
         },
  
        require: {
         name: '/statistics',
         type: '-',
         description: '-',
         },
  
         require: {
         name: '/initialpose',
         type: '-',
         description: '-',
         },
  
         require: {
         name: '/reset_rgbdserver',
         type: 'std_msgs/Bool',
         description: 'To reset server',
         },
  
         require: {
         name: '/scan',
         type: 'sensor_msgs/LaserScan',
         description: 'laser scan data',
         },
  
         require: {
         name: '/tf',
         type: 'tf2_msgs/TFMessage',
         description: 'tf',
         },
  
         require: {
         name: '/tf_static',
         type: 'tf2_msgs/TFMessage',
         description: 'tf static',
         },      
  
        }
     }
  
  Parameter: {
         parameter: {
         name: 'max_delay',
         value: '100'
         },
  
         parameter: {
         name: 'rgb_hints',
         value: 'compressed'
         },
  
         parameter: {
         name: 'depth_hints',
         value: 'raw'
         },
  
         parameter: {
         name: 'bot_frame',
         value: '/base_link'
         },
  
         parameter: {
         name: 'kinect_frame',
         value: '/camera_depth_optical_frame'
         },
  
         parameter: {
         name: 'minZ',
         value: '-1.0'
         },
  
         parameter: {
         name: 'maxZ',
         value: '4.0'
         },    
  }
  </code></pre>
  
  <p>Here is the code which I have written to replace param name's (<code>max_delay</code>) value in yaml file in Parameter section.</p>
  
  <pre><code>#include &lt;fstream&gt;
  #include &lt;iostream&gt;
  #include "yaml-cpp/yaml.h" 
  
  using namespace std;
  
  bool UpdateYAMLFile(const string&amp; sYamlFile, const string&amp; sParamName2Update, const string sValue)
  {
      bool bRet = false;
      try
      {        
          //YAML::Node head_ = YAML::LoadFile(sYamlFile);
                  YAML::Node head_ = YAML::LoadFile(sYamlFile);
  
                  //YAML::Node head_ = YAML::Load(sYamlFile);
  std::cout &lt;&lt; head_.size();
  
                  cout&lt;&lt;"ramesh"&lt;&lt;endl;
          for (YAML::iterator ith = head_.begin();ith != head_.end(); ++ith)
          {
              YAML::Node sub1_ = ith-&gt;second;
              for (YAML::iterator itc = sub1_.begin();itc != sub1_.end(); ++itc)
              {
                  string sParam = itc-&gt;second["name"].as&lt;std::string&gt;(); //cout &lt;&lt; sParam  &lt;&lt; endl;
                  if(sParam == sParamName2Update)
                  {
                      itc-&gt;second["value"] = sValue;
                      bRet = true;
                  }
              }
          }       
          ofstream fout(sYamlFile); 
          fout &lt;&lt; head_;          //cout &lt;&lt; head_ &lt;&lt; "\n";
      }
      catch (const YAML::Exception&amp; e)
      {
          cout &lt;&lt; "ERROR: Updation of yaml file " &lt;&lt; sYamlFile &lt;&lt; "Failed: Exception: " &lt;&lt; e.what() &lt;&lt; "\n";
      }
      return bRet;
  }
  //driver
  int main(int argc, char** argv) 
  {
  
      int bRet = UpdateYAMLFile("sample.yaml", "max_delay","1150");
  
      if(bRet == true)
          cout &lt;&lt; "SUCCESS: YAML file updated..\n";
      else
          cout &lt;&lt; "ERROR: YAML file update FAILED...\n";
  
    return 0;
  }
  </code></pre>
  
  <p>Basically <code>UpdateYAMLFile</code> API will update  <code>max_dealy</code> param value  in sample yaml file. using this API I should be able to update all the param ( <code>max_delay</code>, <code>rgb_hints</code>, <code>depth_hints</code>, <code>minZ</code>, <code>maxZ</code>) in parameter section of sample yaml file.</p>
  
  <p><strong>Command</strong>:</p>
  
  <pre><code> g++ -std=c++0x yaml.cpp -o res /usr/lib/x86_64-linux-gnu/libyaml-cpp.a
  </code></pre>