<分区>
我尝试用这段代码获取字符串“-a”的位置
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
string command("test –a string");
size_t pos = command.find("-a");
cout << "position found = " << pos << endl;
}
这会产生这样的输出:
position found = 4294967295
如果我删除“-”,它会按预期工作。返回 8。