ifstream fin;
string temp;
fin.open("engldict.txt");
if(fin.is_open())
{
bool apos = false;
while(!fin.eof())
{
getline(fin, temp, '\n');
if(temp.length() > 2 && temp.length() < 7)
{
for(unsigned int i = 0; i < temp.length(); i++)
{
if(temp.c_str()[i] == '\'')
apos = true;
}
if(!apos)
dictionary.insert(temp);
}
}
}
このコードにより、実行時エラーが発生します: Word Jumble.exe の 0x00A50606 で未処理の例外: 0xC0000005: アクセス違反の読み取り場所 0x00000014.
そして、次の場所にブレークポイントを投げます:
size_type size() const _NOEXCEPT
{ // return length of sequence
return (this->_Mysize);
}
xstring ヘッダー内。
この例外は、読んでいる単語内に存在する限り、使用する文字に関係なくスローされます。
おそらく非常に簡単な修正であることは承知していますが、それを見るには別の目が本当に必要です. 前もって感謝します。