[ Web Proxy ]
URL:
Viewing: https://ru.cppreference.com/cpp/string/basic_string/getline [Back]  [Original]

std::getline cppreference.com
cppreference.com

std::getline

cppreference.com
 
C++
(C++20)
(C++20)
(C++11)
(C++20)
/
(C++11)
(C++11)
(C++11)
(C++17)
 
 
std::basic_string
-
(C++17)
,
/
( C++20)( C++20)( C++20)( C++20)( C++20)(C++20)
(C++11)(C++11)(C++11)
(C++11)(C++11)
(C++11)(C++11)(C++11)
(C++11)
(C++11)
 
<tbody> </tbody>
template< class CharT, class Traits, class Allocator > std::basic_istream<CharT,Traits>& getline( std::basic_istream<CharT,Traits>& input, std::basic_string<CharT,Traits,Allocator>& str, CharT delim );
(1)
template< class CharT, class Traits, class Allocator > std::basic_istream<CharT,Traits>& getline( std::basic_istream<CharT,Traits>&& input, std::basic_string<CharT,Traits,Allocator>& str, CharT delim );
(1) ( C++11)
template< class CharT, class Traits, class Allocator > std::basic_istream<CharT,Traits>& getline( std::basic_istream<CharT,Traits>& input, std::basic_string<CharT,Traits,Allocator>& str );
(2)
template< class CharT, class Traits, class Allocator > std::basic_istream<CharT,Traits>& getline( std::basic_istream<CharT,Traits>&& input, std::basic_string<CharT,Traits,Allocator>& str );
(2) ( C++11)

. , , , . delim, '\n'. - .

input ,
str ,
delim -

input

, .

#include <string>
#include <iostream>

int main()
{
    std::string name;
    std::cout << "  ? ";
    std::getline(std::cin, name);
    std::cout << ", " << name << ",  .";
}

:

  ?  . 
,  . ,  .

Web Proxy Viewer  |  New URL  |  Original Page