我想从字符串中“提取”信息。字符串始终为格式int int char
。
我在此上花了很长时间,检查了我发现的该网站和Google的“每个”示例,都无济于事。一些示例已编译,但崩溃了(没有溢出。)
这是当前信息,它可以编译但崩溃。
// Data
string str = "53 25 S";
int num1;
int num2;
char type3;
// Read values
sscanf(str.c_str(),"%i %i %c",num1,num2,type3);
您需要操作员的地址,即
sscanf(str.c_str(),"%i %i %c",&num1,&num2,&type3);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句