Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) std::endl

 

std::endl is an output stream modifier to go to the next line and flush the stream's buffer.

 

#include <iostream<

int main()
{
  //Go to next line and flush the std::cout buffer
  std::cout << std::endl;
}

 

The code above is equivalent to the code below [1]:

 

#include <iostream<

int main()
{
  //Go to next line
  std::cout << '\n';
  //Flush the std::cout buffer
  std::cout.flush();
}

 

One does not need to flush the std::cout buffer after every output [1].

 

 

 

 

 

References

 

  1. Angelika Langer, Klaus Kreft. Standard C++ IOStreams and Locales. 1999. ISBN:0-321-58558-5. Chapter 1.2.4, section 'Manipulators', page 23

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict