Writing CR/LF Combination Using CFile::Write() FunctionLast reviewed: October 10, 1997Article ID: Q92803 |
7.00 | 1.00 1.50 1.51 1.52 | 1.00 2.00 2.10 4.00 4.10
MS-DOS | WINDOWS | WINDOWS NTkbprg The information in this article applies to:
SUMMARYIn an application developed with the Microsoft Foundation Classes (MFC) that uses the CFile class, the Write() member function may appear not to correctly process the carriage return-linefeed (CR/LF) combination unless both the carriage return and linefeed are explicitly stated. For example, the following code
CFile file; // ... file.Write("Hello\n", 6); file.Write("Hello\n", 6);produces the following output: Hello Hello However, the following code
file.Write("Hello\n\r", 7); file.Write("Hello\n\r", 7);produces the following output: Hello Hello
MORE INFORMATIONWhen an application uses the CStdioFile class derived from CFile, an application can open a file in either text mode or binary mode. Using a CStdioFile object is the preferred method to place a CR/LF combination into a file. However, if the application must use a CFile object, a CR/LF combination may be explicitly output as demonstrated above.
|
Additional reference words: kbinf 7.00 1.00 1.50 2.00 2.10 2.50 2.51 2.52
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |