Skip to content

Instantly share code, notes, and snippets.

@aqjune
Created April 27, 2021 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aqjune/2ea18cefa4fc1fd98ba1e47ddeab5f97 to your computer and use it in GitHub Desktop.
Save aqjune/2ea18cefa4fc1fd98ba1e47ddeab5f97 to your computer and use it in GitHub Desktop.
tellg.cpp
#include<iostream>
#include<sstream>
using namespace std;
int main() {
stringstream ss;
ss << "aa\nbb\n";
string str1;
getline(ss, str1);
cout << "str(): " << ss.str() << endl;
cout << "str().substr(tellg()): " << ss.str().substr(ss.tellg()) << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment