PRB: CHR(10) Will Embed CHR(13) When Used with SET ALTERNATE

Last reviewed: January 24, 1995
Article ID: Q125198
The information in this article applies to:
  • Microsoft FoxPro for UNIX, version 2.6

SYMPTOMS

When directing output to a file in FoxPro for UNIX by using the SET ALTERNATE command, a carriage return/line feed, "^M", will be added to the end of the line when concatenating a string with CHR(10).

STATUS

This behavior is by design. FoxPro for UNIX is designed to emulate FoxPro for MS-DOS. Line feeds in MS-DOS will return control to the left most character on the next available line. In UNIX line feeds will drop the current cursor position to the line maintaining the cursor position. Therefore, the carriage return is included.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Type in the following

    SET ALTERNATE TO OUTPUT.TXT SET ALTERNATE ON

       ??"THIS IS A STRING" + CHR(10)        && should be terminated with ^N
       ??"THIS IS ANOTHER STRING" + CHR(10)  && should be terminated with ^N
       SET ALTERNATE OFF
       SET ALTERNATE TO
    
    

  2. Edit the file OUTPUT.TXT using an editor such as UNIX vi. At the end of each line "^M" is added. "^M" is a control character that implies line feed and carriage return.


Additional reference words: foxUnix 2.60
KBCategory: kbenv kbprb
KBSubcategory: FxenvOs


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 24, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.