I have a VB method
Public Sub append_text(ByVal s As String)
f1.TextBox1.AppendText(s)
End Sub
which is called over COM from C++
_bstr_t b(L"test\nnew\nlines\n");
ATLENSURE_SUCCEEDED(t->append_text(b));
But the text box ends up saying
testnewlines
Without the aforementioned new lines.
Why is that then?
For the sake of completeness, posting my comment as an answer (now that I know it’s correct…):
Different operating systems consider different character combinations as new lines. The *nixes, for instance, use a single
\n, as in your code. Windows, on the other hand, uses the\r\ncombination. Therefore, the single\nin your string just isn’t enough to be considered a new line marker. Using\r\nwill do the trick.