string :: find返回垃圾值

时间:2013-01-26 02:08:12

标签: c++

以下是我的代码示例

unsigned int pos;
 std::string str ("Carrier_Id_Vendor_file");

 pos = str.find("_Id_Vendor");

 if(pos != std::string::npos)
    std::string strtemp = str.substr(pos);

代码崩溃。此外,当我试图打印pos ...它打印垃圾值。

任何人都可以建议我做错了吗?

0 个答案:

没有答案
相关问题