Cout and endl can be used in an application and in a Dynamic Link Library (DLL) to display information (101185)
The information in this article applies to:
- Microsoft Visual C++ 1.0
- Microsoft Visual C++ 1.5
- Microsoft Visual C++ 2.0
- Microsoft Visual C++ 4.0
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Visual C++ .NET (2003)
- Microsoft Visual C++ .NET (2002)
- Microsoft Visual C++ 2005 Express Edition
This article was previously published under Q101185 SUMMARY The standard output stream (cout) can be used in an
application or Dynamic- Link Library (DLL) to display information. When using
cout in an application and a DLL simultaneously, special care is needed to
ensure that the text display is synchronized. Because the cout text
stream is buffered, text from a DLL may not appear correct relative to text
from the application. To correct this problem, always use the endl manipulator
when outputting text with cout. Below is an example:
cout << "Hello World" << endl;
The endl manipulator inserts a newline character and then flushes the
stream buffer. This ensures that text displayed from the application and DLL is
synchronized.
Modification Type: | Major | Last Reviewed: | 12/9/2005 |
---|
Keywords: | kbinfo kbLangCPP KB101185 kbAudDeveloper |
---|
|