<ostream> 함수

다음은 에 정의된 전역 템플릿 함수입니다 <ostream>. 멤버 함수는 basic_ostream 클래스 설명서를 참조하세요.

endl
ends
flush
swap

endl

줄을 종료하고 버퍼를 플러시합니다.

template class<Elem, Tr>
basic_ostream<Elem, Tr>& endl(
   basic_ostream<Elem, Tr>& Ostr);

매개 변수

Elem
요소 형식입니다.

Ostr
basic_ostream 형식의 개체입니다.

Tr
문자 특성입니다.

Return Value

basic_ostream 형식의 개체입니다.

설명

조작자는 Ostr을 호출합니다.put(Ostr.widen('\n'))을 누른 다음 Ostr를 호출합니다.플러시. Ostr을 반환합니다.

예시

// ostream_endl.cpp
// compile with: /EHsc
#include <iostream>

int main( )
{
   using namespace std;
   cout << "testing" << endl;
}
testing

문자열을 종료합니다.

template class<Elem, Tr>
basic_ostream<Elem, Tr>& ends(
   basic_ostream<Elem, Tr>& Ostr);

매개 변수

Elem
요소 형식입니다.

Ostr
basic_ostream 형식의 개체입니다.

Tr
문자 특성입니다.

Return Value

basic_ostream 형식의 개체입니다.

설명

조작자는 Ostr을 호출합니다.put(Elem('\0')) Ostr을 반환합니다.

예시

// ostream_ends.cpp
// compile with: /EHsc
#include <iostream>

int main( )
{
   using namespace std;
   cout << "a";
   cout << "b" << ends;
   cout << "c" << endl;
}
ab c

flush

버퍼를 플러시합니다.

template class<Elem, Tr>
basic_ostream<Elem, Tr>& flush(
   basic_ostream<Elem, Tr>& Ostr);

매개 변수

Elem
요소 형식입니다.

Ostr
basic_ostream 형식의 개체입니다.

Tr
문자 특성입니다.

Return Value

basic_ostream 형식의 개체입니다.

설명

조작자는 Ostr을 호출합니다.플러시. Ostr을 반환합니다.

예시

// ostream_flush.cpp
// compile with: /EHsc
#include <iostream>

int main( )
{
   using namespace std;
   cout << "testing" << flush;
}
testing

swap

basic_ostream 개체의 값을 교환합니다.

template <class Elem, class Tr>
void swap(
   basic_ostream<Elem, Tr>& left,
   basic_ostream<Elem, Tr>& right);

매개 변수

Elem
요소 형식입니다.

Tr
문자 특성입니다.

left
basic_ostream 개체에 대한 lvalue 참조입니다.

right
basic_ostream 개체에 대한 lvalue 참조입니다.

설명

템플릿 함수 swapleft.swap(right)을 실행합니다.

참고 항목

<ostream>