> no, i trying to create dynamic array with u cell size.
I know that, my point was that you didn't make it long enough.
"Hello" takes SIX bytes of memory, because it's stored as "Hello\0".
> just to close the array.
No, you wrote to (in effect)
temps.c_str()[u] = '\0';
> this is mu code right now.
Post your actual code.
Not your description of what you may (or may not) have done.
Also, there is no actual guarantee that this is where the problem REALLY lies, but it's the only code you posted.
You could try putting
1 2 3 4 5 6 7 8 9 10 11 12
|
#if 0
temps = (CW2A(filename.GetString()));
int u = temps.size();
char * constchar = new char[u];
constchar = &temps[0];
constchar[u] = '\0';
int y = remove(constchar);
if (y == 0)
{
MessageBox(_T("Car removed"));
}
#endif
| |
around sections of code to see if the overall problem goes away.
Sure, it won't delete the file, but if it still crashes, then you're pretty sure that this code wasn't the problem, because it isn't even run any more.