Microsoft KB Archive/101002

From BetaArchive Wiki

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

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


Last Reviewed: June 27, 1995
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.