INFO: Using cout in an Application and DLL

ID: Q101185


The information in this article applies to:
  • Microsoft Visual C++ for Windows, 16-bit edition, versions 1.0, 1.5
  • Microsoft Visual C++, 32-bit Editions, versions 1.0, 2.0, 4.0, 5.0, 6.0


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.

Additional query words:

Keywords : kbLangCPP kbVC kbVC100 kbVC150 kbVC200 kbVC400 kbVC500 kbVC600 kbDSupport
Version : WINDOWS:1.0,1.5; winnt:1.0,2.0,4.0,5.0,6.0
Platform : WINDOWS winnt
Issue type : kbinfo


Last Reviewed: July 14, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.