strcat() *Answered alredy thanks
Code:
POINT pnt;
char *cTitle, *cX, *cY;
char cXBuffer[20], cYBuffer[20];
GetCursorPos(&pnt);
_ltoa(pnt.x,cXBuffer,10);
_ltoa(pnt.y,cYBuffer,10);
cTitle = "Current mouse postion is: ";
SetWindowText(hwnd,cTitle);
I am trying to learn C++, and all this pointer sh*t is killing me
i want to concat together a Title for my app in a timer and chage it every half second or so
Code:
strcat(cTitle, cXBuffer);
strcat(cTitle, ", ");
strcat(cTitle,cYBuffer);
the above code blows up and debug takes me into the string.h to debug strcat() yeah like i'm that good yet its assembly i barly know what assembly looks like anyway i know it goes boom because of cXBuffer and cYBuffer but how do I fix this?
Thanks
here is the code minus typos
Code:
POINT pnt;
char cTitle[27];
char cXBuffer[20], cYBuffer[20];
memset(cTitle,'\0',sizeof(cTitle));
GetCursorPos(&pnt);
_ltoa(pnt.x,cXBuffer,10);
_ltoa(pnt.y,cYBuffer,10);
strcpy(cTitle, "Current mouse postion is: ");
strncat(cTitle, cXBuffer,strlen(cXBuffer));
strncat(cTitle, ", ",strlen(", "));
strncat(cTitle,cYBuffer,strlen(cYBuffer));
SetWindowText(hwnd,cTitle);