UNIX Linefeeds Not the Same in FoxPro for MS-DOS/Windows

Last reviewed: June 27, 1995
Article ID: Q101002
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5 and 2.5a
  • Microsoft FoxPro for MS-DOS, versions 1.02, 2.0, 2.5, and 2.5a

SUMMARY

When you view a file created with low-level file functions for the UNIX system, the linefeeds are ignored by the editor in FoxPro for MS-DOS while the FoxPro for Windows editor recognizes them.

MORE INFORMATION

The end of a line in the MS-DOS operating system is marked by a carriage return and a linefeed (CR/LF). The UNIX system, however, denotes the end of a line with a linefeed only. Therefore, to create a file for the UNIX system while in the MS-DOS environment, you must use low-level file functions to write characters and linefeeds to the file.

When you view this file in the FoxPro for MS-DOS editor, the linefeeds will be ignored and the lines will run together. In the FoxPro for Windows editor, however, the linefeeds will be treated as if they were accompanied by a carriage return.

To illustrate this, the program code below will output the following in FoxPro for MS-DOS:

   hellogoodbye

But in FoxPro for Windows, the following will be displayed instead:

   hello
   goodbye

Sample Code

   linefeed=CHR(10)
   fh=FCREATE('test.txt')
   writevar=FWRITE(fh,'hello')
   writevar=FWRITE(fh,linefeed)
   writevar=FWRITE(fh,'goodbye')
   =FCLOSE(fh)
   MODIFY FILE test.txt

Byte for byte, the file is the same whether it is in FoxPro for MS-DOS or FoxPro for Windows. The only difference is in the way the editors display the file.


Additional reference words: FoxDos FoxWin 1.02 2.00 2.50 2.50a lowlevel low
level
line feed fwrite()
KBCategory: kbprg
KBSubcategory: FxprgGeneral


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: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.