|
Prev: Creating an Application to popup a New SMS message like WM6Pro
Next: Windows mobile 6 in VS 2005 does not display controls on the toolbar
From: Christian on 2 Feb 2008 10:17 Sorry for these simple questions,but I can't find my ideal solution to do a thing. I'm writing a console application for Windows CE based devices and I have an array of chars filled by recv function. I want to display a message box with the content of this array of char: char cResponseBuffer[1024] = ""; nBytesReceived = recv(sIncomingSocket, &cResponseBuffer[1024], 1024, 0); std::string mex = ""; mex.assign(cResponseBuffer); How can I pass this string to DEBUGMSG function? I can't do simply DEBUGMSG(TRUE, (TEXT(mex)); beacuse I receive an error:"unexpected end of file in macro expansion". Qhat's the solution? Is there a better function ti display string in the output console for debugging? Thanks.
From: Michael Salamone on 2 Feb 2008 10:33
First thing to note is that TEXT macro takes a string or character literal, not a var name. Second thing to note is that TEXT is not a string conversion function (I gather you're trying to convert to wide char). Third thing to note is that the first parameter to DEBUGMSG is a debug zone, not a BOOL. TRUE will probably "work" for you, but not correct usage. Final thing is you have to call MessageBox to display a Message Box. DEBUGMSG goes to debugger. printf goes to the console. You can pass a format string to DEBUGMSG or printf. Try %S. E.g. DEBUGMSG(1, (L"%S", mex)); Other possibility if that doesn't work is to convert the string using mbstowcs or MultiByteToWideChar() and pass result to DEBUGMSG or printf. -- Michael Salamone, eMVP Entrek Software, Inc. www.entrek.com "Christian" <voodoo81people(a)gmail.com> wrote in message news:17ab1ff4-c65d-4a96-873c-ec563698394f(a)c23g2000hsa.googlegroups.com... > Sorry for these simple questions,but I can't find my ideal solution to > do a thing. > I'm writing a console application for Windows CE based devices and I > have an array of chars filled by recv function. I want to display a > message box with the content of this array of char: > > char cResponseBuffer[1024] = ""; > nBytesReceived = recv(sIncomingSocket, &cResponseBuffer[1024], 1024, > 0); > > std::string mex = ""; > mex.assign(cResponseBuffer); > > How can I pass this string to DEBUGMSG function? I can't do simply > DEBUGMSG(TRUE, (TEXT(mex)); beacuse I receive an error:"unexpected end > of file in macro expansion". Qhat's the solution? Is there a better > function ti display string in the output console for debugging? Thanks. |