[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Map Newlines to CR

The C compiler lets you choose how to interpret the newline ('\n') and return ('\r') characters. This behavior is controlled by the Map Newlines to CR item in the C/C++ Language Panel.
In most compilers, including CodeWarrior C/C++, '\r' is translated to the value 0x0D, the standard value for carriage return, and '\n' is translated to the value 0x0A, the standard value for linefeed.
However, the C compiler in the Macintosh Programmers Workshop, known as MPW C, '\r' is translated to 0x0A and '\n' is translated to 0x0D-the opposite of the typical behavior.
If you turn this option on, the compiler uses the MPW conventions for the '\n' and '\r' characters.
If this option is off, the compiler uses the CodeWarrior C and C++ conventions for these characters.
If you turn this option on, be sure you use ANSI/ISO C and C++ libraries that were compiled with this option on. If you turn this option on and use libraries built with this option off, you won't be able to read and write '\n' and '\r' properly. For example, printing `\n' would bring you to the beginning of the current line instead of inserting a new line.
This option corresponds to the pragma mpwc_newline. To check whether this option is on, use __option (mpwc_newline). By default, this option is off.
See also "mpwc_newline," and "Checking Options."
For more information on issues relating to compatibility with MPW in Mac OS programming, see Targeting Mac OS.
[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.
Last updated: August 17, 2000