Take the 2-minute tour ×

No matter what i do i just can't get it to work.

ALL i want to do is take a LPCTSTR and a char* and concatenate them into a char*

myfunction(LPCTSTR pass, LPCTSTR fail, LPCTSTR done, char* table,char* db_file, int s_time){    
    char query2[200];
    strcpy(query2,"SELECT value FROM ");
    strcat(query2," WHERE value = '");
    strcat(query2,"' OR value = '");

For the love of all that is holy why is this so hard.

ALSO NO, i can not just USE a string, cstring, stringstream or any other intermediate container. For some reason every time i try to use these i get a memory allocation error.

share|improve this question
hat happens what is the value of query2? –  Mark Jul 31 '12 at 19:40
In this case when i strcat(query2,(char*)fail) only the first character of fail is added to query2. –  Chris Rice Jul 31 '12 at 20:04
Given that comment have you defined UNICODE anywhere as I would guess LPCTSTR are actually LPWSTR so you need to encode them to UTF-8 to use char* –  Mark Jul 31 '12 at 20:10

Your Answer



Browse other questions tagged or ask your own question.