Skip to content

Support file stream #1077

@yihuajack

Description

@yihuajack
struct Design {
    std::string name;
};

struct UserYaml {
    Design design;
};

std::string read_file(const std::filesystem::path& path) {
    std::ifstream file(path);
    return std::string{(std::istreambuf_iterator(file)), std::istreambuf_iterator<char>()};
}

const std::string user_yaml_contents = read_file(user_yaml_path);
UserYaml user_yaml;
struct_yaml::from_yaml(user_yaml, user_yaml_contents);

The program will terminate called after throwing an instance of 'std::runtime_error'
what(): \n is not expected

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions