Microsoft KB Archive/132102

{| = PRB: Unnecessary Carriage Returns in FoxPro for UNIX Files =
 * width="100%"|

ID: Q132102

The information in this article applies to:


 * Microsoft FoxPro for UNIX, version 2.6

SYMPTOMS
It is possible that FoxPro for UNIX files could have both carriage return (CR) and line feed (LF) (also called newline, abbreviated NL) characters in them. An editing program like vi would display the CR-LF pair as a control M (^M). This CR character may cause problems when printing or doing other operations.

CAUSE
One way to end up with unnecessary CR characters is to use functions that produce CR-NL pairs. For example, rather than using FPUTS, use FWRITE to write the string to a file, and then use an FWRITE of CHR(10) to produce the UNIX-style NL character.

RESOLUTION
If the file already has the CR characters in it:

1. Create a shell script through vi or another editor called 'xcr' for

example. 2. The UNIX shell script should contain the following line: tr -d "\015" 3. Use the following command at the UNIX prompt to make the file executable:

chmod 777 xcr 4. To clear CR characters from a file called myfile and put the new file in  mynewfile, use this command:

xcr mynewfile NOTE: The '<' character means for the program xcr to accept input from the file called myfile. Accordingly, the '>' character before mynewfile means to take the output produced from running xcr on myfile and put it into a new file called mynewfile. For more information on file rediretion, consult your UNIX documentation. Additional reference words: FoxUnix 2.60 KBCategory: kbinterop kbprb KBSubcategory: FxinteropGeneral
 * }