stringstream

    4

    1答えて

    最初の新しいトークン(演算子>>で美しく抽出された標準の空白以外の文字シーケンス)を、ストリーム?文字列を抽出し、戻す必要があるかどうかを確認し、内部ストリームイテレータをリセットすることはできますか?ストリーム抽出した後、前と条件付きでなり、ここでtellgとseekg仕事を #include <string> using std::string; #include <sstream

    1

    4答えて

    以下は私の機能です。私は if(try_strtol(v, rhs)) とRHSそれは= 15 Vで真除いI、falseを返す= "15 \トン//コメント" bool try_strtol(int64_t &v, const string& s) { try { std::stringstream ss(s); if ((ss >> v).fai

    12

    8答えて

    私のコードでは、 "number"のようなsthをstringstreamに追加するループがあります。終了すると、 '、'を追加して '}'を追加し、ループを繰り返す場合は '{'を追加する必要があります。 私はignore()を使って '、'を取り除くことができると思ったが、うまくいかなかった。私が何を記述することができるか知っていますか? 例: douCoh << '{'; for(unsi

    1

    2答えて

    出力に戻ってそれを挿入し、次のように私は、ファイルをお読みください。 #include <fstream> #include <iostream> #include <sstream> #include <string> #include <vector> #include <algorithm> #include <numeric> using namespace std; t

    2

    1答えて

    stringループのすべての値をいくつかのデータ型に入力できるwhileループがありますか? stringstream line; while(/*there's still stuff in line*/) { string thing; line >> thing; //do stuff with thing }

    9

    2答えて

    リクエストメソッドがstd::streambuf*のネットワーククライアントがあります。このメソッドは、boost::iostreams::copyによって実装され、ネットワークAPIにデータを書き込む方法を知っているカスタムstd::streambuf由来のクラスに実装されています。これはうまくいきます。つまり、ファイルをすべてメモリに読み込む必要はなく、要求にファイルをストリームすることができ

    7

    2答えて

    sscanf()を含む古い安全でないC関数を取り除こうとしています。今すぐ使用しています #include <sstream> std::string str = "111 222.2 333 444.4 555"; std::stringstream sstr(str); int i, j, k; float dummy1, dummy2; sstr >> i >> dummy1 >>

    120

    5答えて

    私の質問は、stringstream.str().c_str()から返された文字列はどこにありますか?そしてそれはなぜconst char*に割り当てられないのですか? このコード例では、私が でき #include <string> #include <sstream> #include <iostream> using namespace std; int main() {

    2

    2答えて

    私は、サードパーティの型を処理するために、STD :: ostreamにオペレーター< <のための独自の実装を持っているサードパーティのコードを使用しています。 私は、この出力用にstringstreamを使用しています - のような: string ToString(const thrdPartyType& structure) { stringstream outputStream; o

    0

    2答えて

    がheader.h #include <iostream> #include <vector> class CombatLine{ std::stringstream Line; std::vector<std::string> TokenLine; void SetLine(std::string s){ Line<<s; } pu