Just a little input that might help... C-style strings 101.

C-style strings like you were originally having problems with are not really "strings" as such. They're arrays of characters. By convention, the "string" is null-terminated, meaning that the last byte in it is a NULL, or '\0' if you prefer.
char temp[32];
This defines an array of 32 chars. If you were to do:
sprintf(temp,"test");
You'd get values like this:
temp[0] = 't';
temp[1] = 'e';
temp[2] = 's';
temp[3] = 't';
temp[4] = '\0';
For handling these style of strings, look into the "str*" functions.
strcat - Concatenates a couple of strings.
strcpy - Copies one string to another.
strcmp - Compares two strings.
And so on... There's variations on these, like stricmp which is case insensitive, and strncpy which copies only a number of characters and so on. There's a lot of them, and looking into some documentation would be a good idea.
Note that C-style strings are prone to buffer overflows, because there's no bounds checking. That temp variable is 31 characters long, plus a character for the NULL terminate. If you tried to put something in longer than that, it would overwrite the end of it and basically overwrite stuff on the stack. Meaning that if you use these, you need to be very careful and be sure that you don't do that. Usually this means more complicated code.
In C++, most people prefer to use an actual string class, which does it's own bounds checking, can resize as needed, and so forth. std::string is good for this sort of thing. Just #include <string> and then declare your variable like this:
string temp;
string is actually a basic_string in disguise. If you want to be able to handle stuff like Unicode and such, then it's worth the effort to look into other string classes designed with this stuff in mind.
Old C-Style strings still come in handy every once in a while for quick coding because they're actually pretty easy to use, and they're incredibly fast by comparison to most string classes. But in production level code, generally they should be avoided.