You have to use character references or entities (
List of XML and HTML character entity references - Wikipedia[
^]).
In your case it would be:
char lang[] = "'"word";
You can also write a function to do that:
void replace_all(std::string& str, const std::string& search, const std::string& replace)
{
size_t len = search.length();
size_t pos = str.find(search);
while (std::string::npos != npos)
{
str.replace(pos, len, replace);
pos = str.find(search, pos + len);
}
}
void Xmlify(std::string& str)
{
replace_all(str, "&", "&");
replace_all(str, "<", "<");
replace_all(str, ">", ">");
replace_all(str, "\"", """);
replace_all(str, "'", "'");
}