How can I get a new line in messagebox?

I have two TCHAR arrays, I can print both to separate MB but not both to one

This is what I'm looking for (if you can understand what I'm trying)

It obviously does not work.

TCHAR one[] = _T("file\\path\\here");
TCHAR two[] = _T("another\\file\\path\\here");

MessageBox(NULL, one ,_T("pathone"),0); //ok
MessageBox(NULL, two ,_T("pathtwo"),0); //ok

MessageBox(NULL, one + "\n" + two ,_T("pathoneandtwo"),0); //not ok

When I search all I find is "pathhere\nanotherpathhere" which is not what I need.

And I cannot use strcpy and strcat as they are wide or unicode or something, plus visual studio 2010 does not support wstrcpy.

I've tried a number of things, too many to list here

Any help with this please?

I'm not completely sure but you might be able to do this

std::wstring basePath(L"file:");
std::wstring subPath(L"src/main.cpp");
std::wstring fullPath( basePath + L"\n" + subPath );
MessageBox(0,(_T)fullPath.c_str(),0,0);

How can I get a new line in messagebox?

Try using "\r\n" instead of just "\n".

Thanks for the suggestion firstPerson

I should have explained, the two paths are external parameters and I cannot get a std string or wstring into them, this was just a very short producer of my problem.

appreciate your time.

@ Narue The problem is that C++ does not have any concantenation operators as far as I know, the problem in my code above would technically be syntax.

Thanks for you input.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.