I think that there are two options. The first is to open the file in text mode and then read a line at a time, appending each line to your string:
std::string result;
std::ifstream file("myfile.xsd");
if(file.is_open())
{
while(file.good())
{
std::string temp;
std::getline(file, temp);
result.append(temp);
}
file.close();
}
The second way is to treat it as a binary file, read it into memory and then assign to a string. This method may be more efficient if your file is large or has a lot of lines.
std::string result;
char* memblock;
std::ifstream file("myfile.xsd", std::ios::in|std::ios::binary|std::ios::ate);
if (file.is_open())
{
std::ifstream::pos_type size = file.tellg();
memblock = new char[size];
file.seekg(0, std::ios::beg);
file.read(memblock, size);
file.close();
result.assign(memblock, size);
delete[] memblock;
}