私は次の文字列を持っています:
B�#012a#016�G�6�)_#014�d%| 140101 000] [M00FEB11002FA] _13:40:39,08-30-2012�:�</ p>
この単純なコードをコーディングして、|の後にある値1401を取得しました。
問題は、substrを呼び出すと、セグメンテーション違反が発生することです。コードは次のとおりです。
string test = "B�#012a#016�G�6�)_#014�d%|1401 01 000][M00FEB11002FA]_13:40:39,08-30-2012�:�";
int jj = test.find("]");
for (int j = jj ; j > 0 ; j--)
{
if (test.at(j) == '|')
{
test = test.substr(j+1);
test = test.substr(0,test.find_first_of(' '));
}
}
誰かが私が間違っていることを言うことができますか?