#include "cpptoml.h"

#include <iostream>
#include <cassert>

int main(int argc, char** argv)
{
    if (argc < 2)
    {
        std::cout << "Usage: " << argv[0] << " filename" << std::endl;
        return 1;
    }
    cpptoml::toml_group g = cpptoml::parse_file(argv[1]);
    std::cout << g << std::endl;
    return 0;
}

#include "cpptoml.h"

#include <iostream>
#include <cassert>

int main(int argc, char** argv)
{
    if (argc < 2)
    {
        std::cout << "Usage: " << argv[0] << " filename" << std::endl;
        return 1;
    }

    try
    {
        cpptoml::toml_group g = cpptoml::parse_file(argv[1]);
        std::cout << g << std::endl;
    }
    catch (const cpptoml::toml_parse_exception& e)
    {
        std::cerr << "Failed to parse " << argv[1] << ": " << e.what() << std::endl;
        return 1;
    }

    return 0;
}

Handle parsing errors in the example.
Handle parsing errors in the example.

Aborting on invalid input is not especially user-friendly, even for a simple
example.
