If you're trying to copy the whole file to a stringstream, then this:
oss << ifs; is wrong. All that does is prints the address of ifs. What you want to do is this:
oss << ifs.rdbuf(); And then of course, to copy that to a string, like the others are saying:
str = oss.str(); If you just want to get a single line, then skip the stringstream, and just use getline:
std::getline(ifs,str);