LPSTR question
-
Hi I have two 'LPSTR' (or char *) variables and I need some help in figuring out how to insert a number inbetween these two and join (strcat) the two LPSTR variables. I apperciate any help I can get, Thanks! Ex: LPSTR test1; LPSTR test2; test1 = "hello"; test2 = "world"; int x = 9; char buffer[10]; itoa(x,buffer,10); //I need to end up with 'hello 9 world'
-
Hi I have two 'LPSTR' (or char *) variables and I need some help in figuring out how to insert a number inbetween these two and join (strcat) the two LPSTR variables. I apperciate any help I can get, Thanks! Ex: LPSTR test1; LPSTR test2; test1 = "hello"; test2 = "world"; int x = 9; char buffer[10]; itoa(x,buffer,10); //I need to end up with 'hello 9 world'
-
You can do this: char test1[256]; char test2[256]; sprintf(test1, "hello"); sprintf(test2, "world"); int x = 9; char buffer[256]; sprintf(buffer, "%s %d %s", test1, x, test2); the buffer will contain 'hello 9 world'
Chipper Martin