Converting from type char to const char*

I'm trying to work on my loading function still. I get 10 lines into an array, from a text file, and now need to insert a colon in the right spaces, and then send each to a list. I get a windows error message when I do this, and the problem is with the strcats. Here's my attempt:

Somewhere, as a global variable or a class member, you already have defined char * times[11], correct? The last line does nothing, it's not needed because you have the for loop. The last line essentially temporarily creates a *second* variable called times, which only exists until the SetUp() function returns (immediately after that line).

One big problem:

Code:

char* string = "";

This, again, allocates space only for the pointer, not the string itself. You're trying to make the program write (using strcat) into memory that's not allocated. You MUST allocate space to write into, either using new and delete, or an array. You want the pointer to point to space that it can write into; as it is, it points somewhere in a data segment (where it put the one-byte string ""), somewhere you probably should NOT be writing to. If you make a pointer point at a string literal, it's very bad karma to write to it. You shouldn't be writing into the regions of memory that store the literals.

And as for your strcat, you're going to end up with absolute garbage. There are actually multiple problems:

1) You're casting from a character to a pointer, so it will interpret the character '1', for example, as a memory location (address 0x0000 0031).

2) Even if you didn't have the casting problems, your string segments aren't null terminated.