标签: c++ line substr
我正在处理一个函数,它需要我取一行前两个元素的子串。
char那些= line.substr(0,1);
当我运行程序时,它只接受第一个元素,就是它。
你能告诉我我做错了吗?
另外,如何告诉C ++从索引中获取以下元素直到行尾?
答案 0 :(得分:1)
第二个参数是the number of elements to take, not an inclusive index。