다음을 통해 공유


basic_istream::ignore

Causes a number of elements to be skipped from the current read position.

basic_istream<Elem, Tr>& ignore(
    streamsize _Count = 1,
    int_type _Delim = traits_type::eof( )
);

매개 변수

  • _Count
    The number of elements to skip from the current read position.

  • _Delim
    The element that, if encountered before count, causes ignore to return and allowing all elements after _Delim to be read.

반환 값

The stream (*this).

설명

The unformatted input function extracts up to _Count elements and discards them. If _Count equals numeric_limits<int>::max, however, it is taken as arbitrarily large. Extraction stops early on end of file or on an element _Ch such that traits_type::to_int_type(_Ch) compares equal to _Delim (which is also extracted). The function returns *this.

예제

// basic_istream_ignore.cpp
// compile with: /EHsc
#include <iostream>
int main( ) 
{
   using namespace std;
   char chararray[10];
   cout << "Type 'abcdef': ";
   cin.ignore( 5, 'c' );
   cin >> chararray;
   cout << chararray;
}
  abcdef

FakePre-caa772e21c7e40b1b25dba662542aa8d-bb30bd9e2c5c4ef3ad8edc284eb47516

요구 사항

Header: <istream>

네임스페이스: std

참고 항목

참조

basic_istream 클래스

iostream 프로그래밍

iostreams 규칙