Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Function template write_ini

boost::property_tree::ini_parser::write_ini

Synopsis

// In header: <boost/property_tree/ini_parser.hpp>


template<typename Ptree> 
  void write_ini(const std::string & filename, const Ptree & pt, 
                 int flags = 0, const std::locale & loc = std::locale());

Description

Translates the property tree to INI and writes it the given file.

Parameters:

filename

The name of the file to which to write the INI representation of the property tree.

flags

The flags to use when writing the INI file. The following flags are supported:

  • skip_ini_validity_check – Skip check if ptree is a valid ini. The validity check covers the preconditions but takes O(n log n) time.

loc

The locale to use when writing the file.

pt

The property tree to tranlsate to INI and output.

Requires:

pt cannot have data in its root.

Requires:

pt cannot have keys both data and children.

Requires:

pt cannot be deeper than two levels.

Requires:

There cannot be duplicate keys on any given level of pt.

Throws:

info_parser_error In case of error translating the property tree to INI or writing to the file.

PrevUpHomeNext