The newline character (\n) is equivalent to the ASCII linefeed character (hex 0A) (48885)



The information in this article applies to:

  • The C Run-Time (CRT), when used with:
    • Microsoft C for MS-DOS
    • Microsoft C for OS/2
    • Microsoft Visual C++ for Windows, 16-bit edition 1.0
    • Microsoft Visual C++ for Windows, 16-bit edition 1.5
    • Microsoft Visual C++, 32-bit Editions 1.0
    • Microsoft Visual C++, 32-bit Editions 2.0
    • Microsoft Visual C++, 32-bit Editions 4.0
    • Microsoft Visual C++, 32-bit Editions 5.0
    • Microsoft Visual C++, 32-bit Editions 6.0
    • Microsoft Visual C++ 2005 Express Edition
    • Microsoft Visual C++ .NET (2003)
    • Microsoft Visual C++ .NET (2002)

This article was previously published under Q48885
Note Microsoft Visual C++ .NET 2002 and Microsoft Visual C++ .NET 2003 support both the managed code model that is provided by the Microsoft .NET Framework and the unmanaged native Microsoft Windows code model. The information in this article applies only to unmanaged Visual C++ code. Microsoft Visual C++ 2005 supports both the managed code model that is provided by the Microsoft .NET Framework and the unmanaged native Microsoft Windows code model.

SUMMARY

The newline character (\n) is equivalent to the ASCII linefeed character (hex 0A). Thus, for files opened in text mode, CR/LF pairs are read in as newline characters, and newline characters are written as CR/LF.

This information applies to STDIN, STDOUT, and STDERR, which are opened in text mode by default.

When using strtok() to extract tokens separated by CR/LF in a file opened in text mode, only \n must be used as a token delimiter.

Modification Type:MajorLast Reviewed:1/9/2006
Keywords:kbinfo KB48885 kbAudDeveloper