[#bsl-getline-08]
= xref:bsl.adoc[bsl]::getline
:relfileprefix: ../
:mrdocs:

`getline` overloads

== Synopses

Declared in `&lt;bslstl&lowbar;string&period;h&gt;`

Replace the contents of the specified `str` string by extracting characters from the specified `is` stream until a newline character (&grave;is&period;widen(&apos;
&apos;)`) is extracted, and return `is&grave;&period; The newline character is removed from the input stream but is not appended to `str`&period; If an `eof` is detected before the newline, then the characters up to the `eof` are put into `str` and `is&period;eof()` becomes true&period; If `is&period;good()` is false on entry, then do nothing, otherwise if no characters are extracted (e&period;g&period;, because because the stream is at eof), `str` will become empty and `is&period;fail()` will become true&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class CHAR&lowbar;TYPE,
    class CHAR&lowbar;TRAITS,
    class ALLOCATOR&gt;
std::basic&lowbar;istream&lt;CHAR&lowbar;TYPE, CHAR&lowbar;TRAITS&gt;&
xref:bsl/getline-0a.adoc[getline](
    std::basic&lowbar;istream&lt;CHAR&lowbar;TYPE, CHAR&lowbar;TRAITS&gt;& is,
    xref:bsl/basic_string-0faf.adoc[basic&lowbar;string&lt;CHAR&lowbar;TYPE, CHAR&lowbar;TRAITS, ALLOCATOR&gt;]& str);
----

[.small]#xref:bsl/getline-0a.adoc[_» more&period;&period;&period;_]#

Replace the contents of the specified `str` string by extracting characters from the specified `is` stream until the specified `delim` character is extracted, and return `is`&period; The `delim` character is removed from the input stream but is not appended to `str`&period; If an `eof` is detected before `delim`, then the characters up to the `eof` are put into `str` and `is&period;eof()` becomes true&period; If `is&period;good()` is false on entry, then do nothing, otherwise if no characters are extracted (e&period;g&period;, because because the stream is at eof), `str` will become empty and `is&period;fail()` will become true&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class CHAR&lowbar;TYPE,
    class CHAR&lowbar;TRAITS,
    class ALLOCATOR&gt;
std::basic&lowbar;istream&lt;CHAR&lowbar;TYPE, CHAR&lowbar;TRAITS&gt;&
xref:bsl/getline-04.adoc[getline](
    std::basic&lowbar;istream&lt;CHAR&lowbar;TYPE, CHAR&lowbar;TRAITS&gt;& is,
    xref:bsl/basic_string-0faf.adoc[basic&lowbar;string&lt;CHAR&lowbar;TYPE, CHAR&lowbar;TRAITS, ALLOCATOR&gt;]& str,
    CHAR&lowbar;TYPE delim);
----

[.small]#xref:bsl/getline-04.adoc[_» more&period;&period;&period;_]#


[.small]#Created with https://www.mrdocs.com[MrDocs]#
