Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
Wei, Jimmy T edited this pageMar 10, 2023 ·1 revision

Text I/O end of line

The use of '\n' is recommended over std::endl except if the explicit flush is desired​

  • The varying line-ending characters don't matter, assuming the file is open in text mode, which is what you get unless you ask for binary. The compiled program will write out the correct thing for the system compiled for. ​
  • The only difference is that std::endl flushes the output buffer, and '\n' does not. If you don't want the buffer flushed frequently, use '\n'.​
  • If you want to flush before the main/global scope destructors are called, then std::endl is needed at that point.​Additional information can be found inC++ Core Guidelines

Additional Information on DPC++ topics can be found in the book(pdf):

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp