i want msgbox to show numbers
but for some reason it's not work i tried cast but it's not work
someone can plz help me?
Printable View
i want msgbox to show numbers
but for some reason it's not work i tried cast but it's not work
someone can plz help me?
A quick way;
Code:int x = 10;
char buff[3];
sprintf(buff,"%s",x);
MessageBox(0,buff,"And the number is:",MB_OK);
it's not work
and what's sprintf() and wsprintf()?
Doh!!! slight ballsup
should be;
sprintf and wsprintf are an easy way to put an integer into a string (MessageBox will only take a string buffer).Code:int x = 10;
char buff[3];
sprintf(buff,"%i",x);
MessageBox(0,buff,"And the number is:",MB_OK);
You need the header stdio.h
try this:
sprintf puts a value/string/whatever into a buffer.Code:#include <stdio.h>
#include <windows.h>
int main(void)
{
int x = 10;
char buff[3];
sprintf(buff,"%i",x);
MessageBox(0,buff,"And the number is:",MB_OK);
return 0;
}
edit 1:
Damn you for fixing it before me! We must've posted at the same exact time.