[英]Is there an equivalent readline().split() python function in C++?
本质上,
int main( int argc, char** argv )
确实做到了(或非常接近)。 我想知道是否可以将int main( ... )
功能与其他功能一起复制。 例如,说我有一个
readline();
从文件中读取一行的函数。 我想知道该行包含argc
参数argc
,以及每个参数argv
的数组(其中行中的空格代表一个新参数)。 所以我有两个问题:
int main()
函数之外,C ++中是否存在这样的函数? string
类是否具有此功能。 谢谢!
#include <boost/algorithm/string.hpp>
std::vector<std::string> strs;
boost::split(strs, "word1 word2 word3", boost::is_any_of(", "));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.