Thread: C++ Code Error?
View Single Post
  #8   Spotlight this post!  
Unread 19-01-2003, 15:47
Zmeko Zmeko is offline
Registered User
no team
 
Join Date: Jan 2003
Location: Freehold Iowa
Posts: 15
Zmeko is an unknown quantity at this point
char *display;
long number=30001;
ltoa(number,display,5);
MessageBox(hWnd,display,"test",MB_OK);

how to fix this problem?

you can do it Kevin Watson way or you can the other way.

char *display;
long number=30001;

display = 0;
display = new char[sizeof(long)*8+1];
ltoa (number,display,10);
printf("Buffer = %s\n", display);

i think when people post a question with code, it should be required that you answer them with code.

http://www.cplusplus.com/ref/cstdlib/ltoa.html
http://www.cplusplus.com/ref/cstdlib/fcvt.html

Last edited by Zmeko : 19-01-2003 at 16:12.