I have the following code, but it causes an exception. Without itoa “games” I don’t think there’s a problem. TextOutA is because I use winapi.
char* p1 = new char[2];
itoa(10,p1,10);
TextOutA(hDC,5, currenty,p1,2);
delete[] p1;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your stringbuffer is too short
itoa overruns the buffer capacity in writing the null termination character.
I suggest you make the buffer big enough to accomodate the full integer range.
Edit Just in case, elaborating on the string stream suggestion: