// 删除某字符串中的某个字符
// str 原字符串
// word 欲删除的字符
//
// 处理过后的字符串直接返回到原字符串中
void DeleteWord(wchar_t str[], wchar_t word)
{
// 临时存储修改好的字符串
wchar_t* tempstr = new wchar_t[lstrlen(str) + 1];
wsprintf(tempstr, L"");
// 删除换行
for (int i = 0, j = 0; i < lstrlen(str); i++, j++)
{
// 跳过换行
if (str[i] == word)
{
j--;
continue;
}
else
{
wsprintf(tempstr, L"%ls%c", tempstr, str[i]);
}
}
// 将修改好的字符串复制过去
lstrcpy(str, tempstr);
if (tempstr != NULL)
{
delete[] tempstr;
tempstr = NULL;
}
}