Hello, I am trying to append a sf::string by adding text of type sf::Text. Then i want to write this file with a ofstream to a textfile. What i need this for is to save the history from the text input in my game.
Example Code):
sf::String string1 = "";
sf::Text text1("Input: ", somefont, somesize);
sf::Text text2("Go north ", somefont, somesize);
sf::Text text3("Going north!", somefont, somesize);
string1 += text1.getString();
string1 += text2.getString();
string1 += text3.getString();
std::ofstream myfile;
myfile.open ("History.txt");
myfile << string1; //Error here, cant add a sf::string
myfile.close();
I have tried casting the sf::string after the appending to a std::string like this:
std::string temp = string1;
but that doesent work either. whats the correct way of doing a appending and filewriting with a sf::string?
Would love to see some code examples aswell since im quite new to Sfml!