c++ 中的 stream stringstream

创建日期: 2023-08-03 15:35 | 作者: 风波 | 浏览次数: 16 | 分类: C++

来源:https://en.cppreference.com/w/cpp/io/basic_stringstream

继承关系

图片

Member types

Member type Definition
char_type CharT
traits_type Traits; the program is ill-formed if Traits::char_type is not CharT.
int_type Traits::int_type
pos_type Traits::pos_type
off_type Traits::off_type
allocator_type Allocator

Member functions

String operations

stringstream 的使用

try {
    //pass
} catch (const std::exception& e) {
    std::stringstream ss;
    ss << e.what();
    std::string msg = ss.str();
}

Inherited from std::basic_istream

Member functions

有格式的 - operator>> extracts formatted data (public member function of std::basic_istream)

无格式的

16 浏览
14 爬虫
0 评论