Replace:

    +    boost::scoped_array<char> planBytes(new char[length + 1]);
    ... <read loop>
    +    // null terminate
    +    planBytes[length] = '\0';
    +
    +    // need to return a string
    +    return std::string(planBytes.get()); 

with:
    +    char planBytes[length];
    ... <read loop>
    +    return std::string(planBytes, length);