App runs in during debug but on it's own?

Hi there,

I have a very simple piece of code - but it only returns the right value when I am stepping through it with a debugger. The code is below...
1
2
3
4
5
6
const wchar_t* src = L"This is a wide character string.";
int32_t len = wcslen(src);
wchar_t* dest = new wchar_t[len + 1];
wcsncpy(dest, src, len);
int32_t value = wcsncmp(src, dest, len);
return (value == 0);

I am not doing anything difficult here but if I run it without stepping through it then it returns false. When I step through it, value equals zero and it returns true.

Any ideas?

Thanks for any assistance that is offered.

Phil.
Topic archived. No new replies allowed.