Creating a newline in a string

Ok so i'm working with a GUI program that has a text field but it doesnt have a text box, so I figure i can try creating one, but I cant figure out how to add a new line to the text, how would I do that?

This is what I have so far. it's just a snippet.

1
2
3
4
5
6
7
8
9
string f;

        f = text_box->GetText();

        if(f.length() >= 10)
        {
            cout << "Test" << endl;
            f += '\n';
        }
I guess that you're looking for the insert function of the string:

http://www.cplusplus.com/reference/string/string/insert/

With this you can insert a new line at the position 10
Topic archived. No new replies allowed.