|
Never use strcat, because strcat will modify the content of a1, which means that the first parameter must not be const.
Note that your string is a constant pointer and it points to a string constant. The data stored in the constant area cannot be modified.
And your a3 has no allocated space at all.
First, a3 should be defined as LPTSTR, otherwise it is a constant and cannot be modified. Then use:
a3 = (TCHAR *) malloc(255 * sizeof(TCHAR));
strcpy (a3, a1);
strcat (a1, a2);
That's it. |
|