Jump to content

Recommended Posts

Posted

Hi,

I tried to convert an int to a string,

but he shows me 0, 5, and then nothing.

Here the source:

har Te [40];

sprintf(Te, "%i", TalerNr);

if (MessageBox (MainWindow, (unsigned short *)Te, TEXT("Punktzahl"), MB_OK | MB_ICONINFORMATION) == MB_OK);

Guest MrMagoo
Posted
Hi,

I tried to convert an int to a string,

but he shows me 0, 5, and then nothing.

Here the source:

har Te [40];

sprintf(Te, "%i", TalerNr);

if (MessageBox (MainWindow, (unsigned short *)Te, TEXT("Punktzahl"), MB_OK | MB_ICONINFORMATION) == MB_OK);

i think the correct placeholder for an integer is %d in printf, but also you might be better of declaring Te as a TCHAR and using wsprintf

TCHAR Te[40];

wsprintf(Te, L"%d", TalerNr);

if (MessageBox (MainWindow, Te, TEXT("Punktzahl"), MB_OK | MB_ICONINFORMATION) == MB_OK);

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.