Search code examples
c++stringopenglimgui

Show longer String with ImGui


I'm using ImGui, the implementation for OpenGL worked fine but now I have a problem with rendering some Text. For some reason, whenever I try to render a string with ImGui::Text(someString.c_str()); ImGui renders only the first 19 characters. If I try to render the same Text with ImGui::Text("This is a Text longer than 19 characters") ImGui renders the whole Text.

I tried it with also with ImGui::TextUnformatted(&someString[0], &someString[someString.size()-1]);, same result: the first 19 characters are shown, but the rest is cut away.

But if I do std::clog << someString.c_str() it works completly fine.

I would be very glad if someone could spot my mistake, I tried many hours but wasn't able to fix it.


Solution

  • The Problem was that I never had the Idea to use another string... The content of someString contained a 'ü' which terminated the string. But why 'ü' doesn't work with ImGui is another question.