24.4 oefstream

These classes, oeifstream and oeofstream, provide I/O handling for files as well as other data sources with assigned system file descriptors.

oeifstream ifs;
oeofstream ofs;

ifs.open("input.txt");
ofs.open("output.txt");

std::string buffer;
while (ifs && ofs)
{
    if (ifs.getline(buffer))
        ofs << buffer;
}

ifs.close();
ofs.close();