-1

I'm trying to get sf::Text value into a std::string with no success.

Here is the line of code :

std::string s = input_text.getString();

Does someone knows why this doesn't work?

It also says something about symbols from sfml-graphics-d-2.dll not being loaded ..

I am getting this error:

Debug assertion failed!

Expression : _pFirstBlock == pHead

If someone has a solution I would be thankfull.

4
  • sf::Text::getString(); doesnt return a std::string, look at the documentation. Commented Jun 28, 2016 at 17:41
  • @HannesHauptmann yes but how can I get the string value from the sf::Text? Commented Jun 28, 2016 at 18:04
  • That line of code looks OK to me since there is an implicit case from sf::String to std::string. _pFirstBlock == pHead hints at a heap corruption of some sort, perhaps from mismatched versions of the msvcrt. (Either mixing versions, or mixing debug and release.) In fact, here is someone with a similar issue who fixed it by making sure SFML was compiled with the same version of studio as their project. Commented Jun 28, 2016 at 18:12
  • Yes I know there is a implicit conversion .. @SeanCline Would it work also with SFML 2.0? Commented Jun 28, 2016 at 18:24

1 Answer 1

1

getString() returns SFML wrapper of string, use .toAnsiString()

string str = input_text.getString().toAnsiString();
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.