Skip to content

Question: should I check for read errors after urdl::stream::rdbuf() #8

@jamiebullock

Description

@jamiebullock

It's not clear to me how to correctly handle errors when using the following idiom:

std::ofstream os(path, std::ios_base::out | std::ios_base::binary);
            
if (!os)
{
       throw std::runtime_error(...);
}   
            
os << is.rdbuf();
is.close();
os.close();

Should I for example check after os << is.rdbuf() using something like:

if (!is)
{
         throw std::runtime_error(is.error().message());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions