The Wayback Machine - https://web.archive.org/web/20170617051641/http://ja.cppreference.com/w/cpp/io/basic_istringstream/str
名前空間
変種
操作

std::basic_istringstream::str

提供: cppreference.com

 
 
入力/出力ライブラリ
I / Oのマニピュレータ
CスタイルのI / O
バッファ
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf(廃止予定)
ストリーム
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
抽象化
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
ファイルI / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
文字列I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
アレイのI / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream(廃止予定)
ostrstream(廃止予定)
strstream(廃止予定)
タイプ
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
エラーカテゴリインターフェース
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category(C++11)
io_errc(C++11)
 
std::basic_istringstream
メンバ関数
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream::basic_istringstream
basic_istringstream::operator=
basic_istringstream::swap
basic_istringstream::rdbuf
文字列操作
Original:
String operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream::str
 
std::basic_string<CharT,Traits,Allocator> str()const;
(1)
void str(conststd::basic_string<CharT,Traits,Allocator>& new_str);
(2)
基になる文字列オブジェクトの内容を管理します.
Original:
Manages the contents of the underlying string object.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
rdbuf()->str()を呼び出したかのように、基礎となる文字列のコピーを返します。.
Original:
Returns a copy of the underlying string as if by calling rdbuf()->str().
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
rdbuf()->str(new_str)を呼び出したかのように、基礎となる文字列の内容を置き換え.
Original:
Replaces the contents of the underlying string as if by calling rdbuf()->str(new_str).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集]パラメータ

new_str -
基になる文字列の新しい内容
Original:
new contents of the underlying string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集]値を返します

1)
基になる文字列オブジェクトのコピー.
Original:
a copy of the underlying string object.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
(なし)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集]

#include <sstream>#include <iostream>int main(){int n;   std::istringstream in;// could also use in("1 2") in.str("1 2"); in >> n;std::cout<<"after reading the first int from \"1 2\", the int is "<< n <<", str() = \""<< in.str()<<"\"\n";   std::ostringstream out("1 2"); out <<3;std::cout<<"after writing the int '3' to output stream \"1 2\""<<", str() = \""<< out.str()<<"\"\n";   std::ostringstream ate("1 2", std::ios_base::ate); ate <<3;std::cout<<"after writing the int '3' to append stream \"1 2\""<<", str() = \""<< ate.str()<<"\"\n";}

出力:

after reading the first int from "1 2", the int is 1, str() = "1 2" after writing the int '3' to output stream "1 2", str() = "3 2" after writing the int '3' to append stream "1 2", str() = "1 23"

[編集]も参照してください

置き換えるか、または関連付けられた文字列のコピーを取得します
Original:
replaces or obtains a copy of the associated character string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数of std::basic_stringbuf)[edit]
close