Skip to content
mrtalley edited this page Dec 7, 2017 · 1 revision
  • ifstream
    • ifstream i
    • peek()
      • i.peek();
      • Allows you to look at the character (byte) in the stream w/o removing it from the stream.
    • get()
      • Returns and consumes the next character in the stream
    • getline()
      • Two getline()s in C++
        • std::istream::getline()
          • cin.getline(char *, int)
          • String has to be big enough
        • std::getline(cin, std::string &)
          • uses a string object, which can grow
      • Both versions have an optional third parameter to specify a delimiter -- default is '\n'
    • operator>>()
      • Skips leading whitespace, then reads until next whitespace
  • stringstream *
    • Similar to Java ArrayLists
    • Declare with templated (parameterized) type:
      • vector<int> v;
Clone this wiki locally