It seems that you are just started programming C/C++, because your code shows some misunderstandings and will probably result in buffer overflows. But everybody was a beginner once and made such or similar mistakes.
A proper implememtation of your code would be:
size_t remove_space(wchar_t *equation)
{
size_t len = wcslen(equation);
wchar_t *equation2 = new wchar_t[len+1];
size_t eq_index = 0;
for (size_t i = 0; i <= len; i++)
{
if (equation[i] != L' ' && equation[i] != L'\t')
equation2[eq_index++] = equation[i];
}
wcscpy(equation, len+1, equation2);
delete [] equation2;
return --eq_index; }
However, removing chars from a string may be also done without using a help string. Another option is to use a string class providing a remove function (e.g.
CString
and
Remove
).