[cs23021-2] getline vs. getline

Mikhail Nesterenko mikhail at cs.kent.edu
Tue Mar 2 18:51:26 EST 2010


CSI students,

There are two different getline-s in C++, their usage and operation
differs. The differences are important. The one I talk about in class

   getline(stream_name, string_name)

is defined in <string> header file and enters user input into a
string. It is covered in Savitch on pages 472-475.

   stream_name.getline(character_array, size) 

enters user input into arrays of characters (called c-style
strings). We do not cover c-style strings or using getline in this
way in this class. Savitch covers using geline in this way on pages
447-459.


Thanks,
--
Mikhail


More information about the cs23021-2 mailing list