ughh.. How would i convert int to LPCSTR?

T_T
im messing with the control event stuff...
LPCSTR is just a const char*

So convert the number to a string ( see http://cplusplus.com/articles/numb_to_text/ )

Then do this:

1
2
3
4
5
string mystring;

// convert num to string here

LPCSTR foo = mystring.c_str();


But note that you probably want LPCTSTR and not LPCSTR. (ie: TCHAR, not char).

See this for details:

http://cplusplus.com/forum/articles/16820/
i made it like this:

int lol=wParam;
const char result[]={lol,""};
--I put the "" in there because else the value had some weird stuff in it -.-'
MessageBox(0,result,"blah",MB_OKCANCEL);


i bet it cause a few memory overwrites and soon gonna crash my cmputer but at least it worked :3
well that's wrong. =P

Read this article: http://cplusplus.com/articles/numb_to_text/ . The very first example in the article shows how to do it. Combine that with the example I gave in my previous post.

Also, per the other article I linked, MessageBox takes a LPCTSTR, not a LPCSTR, so you should either be using TCHARs, or calling MessageBoxA instead of MessageBox()
:c

What libraries i need to include to get it work? :P
as mentioned in the article I linked:

#include <sstream>
#include <string>
ok...
*To another-thread mobile!*
Topic archived. No new replies allowed.