错误:访问冲突写入位置。在0x52CEE39(uncrtbased.dll)抛出异常

这是一个类似于MS Word的替换功能。句子是原文。 ind是用户要替换的单词的起始索引。 (我已经从句子数组中找到了单词的索引,并将它们存储在ind中),wlength是将要替换的单词的长度。 Temp是我存储结果的地方。 nword是将取代旧单词的新单词 编辑:所有数组的大小相同,所有数组都足够,所有数组都以null结尾

void replace(char sentence[],char ind[],int wlength,char temp[],char nword[])
{
    int a = 0,x = 0,t = 0,j = 0;
    for (int i = 0; i < stringlength(ind); i++) {
        while (a < ind[i]) {
            temp[t] = sentence[a];
            t++;
            a++;
        }
        a = a + wlength;
        t = t + 1;
        strcat(temp,nword); // <---- Error
    }
    for (int x 0; x < stringlength(temp),x++)
        cout << temp[x];
}
super_grubby 回答:错误:访问冲突写入位置。在0x52CEE39(uncrtbased.dll)抛出异常

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3038620.html

大家都在问