Question: String is an array of characters with a null terminator and you said string is non-null but c_str() is null terminated.
One minute response: Ah, this is why it's important to keep a tight reign on terms. The string class is not required to represent strings as arrays of characters nor to use a null character to terminate the character sequence. The C/C++ convention is to represent strings as arrays of characters terminated by a null character. The c_str() string-class member function translates from the string-class representation to the C/C++ convention.
Question: When is it useful to use string streams?
One minute response: I find them helpful when testing procedures that use i- or o-streams; it's much easier using a string stream then setting up a file. We'll see other uses later in the the semester.
Question: No questions.
Question: Assertions [?].
This page last modified on 16 July 2003.