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

ID: Q125198

The information in this article applies to:

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

Last Reviewed: January 24, 1995