Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/138.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++将字符串拆分成数组_C++_String - Fatal编程技术网

C++将字符串拆分成数组

C++将字符串拆分成数组,c++,string,C++,String,我们提出了几个类似的答案 #include <sstream> 我在这里首次使用了未声明的变量'istringstream'。 好的,试一试: std::istrstream is(s); 差不多可以。错误:调用'istrstream::istrstream string&'时没有匹配的函数。 但至少它编译时包含: std::istrstream is(); 所以我觉得我就差一点了:缺少了什么?好的,我安装了代码块,并使用了mingr32-g++编译器。 我当前的生成器配置:

我们提出了几个类似的答案

#include <sstream>
我在这里首次使用了未声明的变量'istringstream'。 好的,试一试:

std::istrstream is(s);
差不多可以。错误:调用'istrstream::istrstream string&'时没有匹配的函数。 但至少它编译时包含:

std::istrstream is();

所以我觉得我就差一点了:缺少了什么?

好的,我安装了代码块,并使用了mingr32-g++编译器。 我当前的生成器配置:

{
"cmd": ["mingw32-g++", "${file}", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"path":"C:/Program Files (x86)/CodeBlocks/MinGW/bin",
    "variants":
    [
        {
            "name": "Run",
            "cmd": ["g++", "$file", "-o", "$file_base_name", "&&", "$file_path/$file_base_name"],
            "shell": true
        }
    ]
}

include已弃用或可能已过时。无论如何,这就是你想要的。你必须使用include而不是include?如果你没有sstream头,我想这就是你想要说的,切换到过去15年中制造的编译器。你在用什么编译器?@intery:g++;从崇高的文本3中编译
std::istrstream is();
{
"cmd": ["mingw32-g++", "${file}", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"path":"C:/Program Files (x86)/CodeBlocks/MinGW/bin",
    "variants":
    [
        {
            "name": "Run",
            "cmd": ["g++", "$file", "-o", "$file_base_name", "&&", "$file_path/$file_base_name"],
            "shell": true
        }
    ]
}