Microsoft KB Archive/117385

= FIX: printf Does Not Recognize "\n\r" when Using Conversion =

Article ID: 117385

Article Last Modified on 11/18/2003

-

APPLIES TO

 The C Run-Time (CRT), when used with:  Microsoft Visual C++ 1.0 Professional Edition

 Microsoft Visual C++ 1.5 Professional Edition 

-



This article was previously published under Q117385



SYMPTOMS
If an explicit type-conversion syntax is used for the return value of printf, printf does not recognize the escape sequence \n\r in its format string.

The following macro prints " \n\r": #define PRINT(x) void( printf("%s\n\r", x ) )



RESOLUTION
To correct the error, use one of the following workarounds:

  Use ASCII values for the line feed and carriage return. For example: #define PRINT(x) void( printf("%s%c%c",x,10,13 ) ) -or-

</li>  Use explicit typecasting instead. For example: #define PRINT(x) (void)( printf("%s\n\r",x ) ) -or-

</li>  Program without the conversion or casting if possible. For example: #define PRINT(x) printf("%s\n\r", x ) </li></ol>

<div class="status_section">

STATUS
Microsoft has confirmed this to be a bug in the products listed at the beginning of this article. This problem was corrected in Visual C++ 32-bit Edition, version 2.0.

Additional query words: 1.00 1.50

Keywords: kbbug kbfix kbcrt KB117385

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.