Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!iuvax!bsu-cs!dhesi From: dhesi@bsu-cs.bsu.edu (Rahul Dhesi) Newsgroups: comp.unix.questions Subject: Re: end of line character Keywords: eol Message-ID: <8135@bsu-cs.bsu.edu> Date: 7 Jul 89 17:28:40 GMT References: <429@ncelvax.UUCP> Reply-To: dhesi@bsu-cs.bsu.edu (Rahul Dhesi) Organization: CS Dept, Ball St U, Muncie, Indiana Lines: 31 In article <429@ncelvax.UUCP> cathy@ncelvax.UUCP (Cathy Benney) writes: [how do I do newline conversions when moving files from UNIX to MS-DOS?] UNIX uses the ASCII linefeed character as the end-of-line character (assuming ASCII; there are rumors [*shudder*] of an EBCDIC UNIX). MS-DOS uses an ASCII carriage return followed by an ASCII linefeed to terminate each line. Converting a UNIX text file to the MS-DOS format requires the following transformation: LF => CR LF I recently posted a newline conversion program (called "flip", which stands for "file interchange program") to alt.sources, and I have sent the production version to comp.sources.misc for posting. A compiled binary will also eventually appear in comp.binaries.ibm.pc. There are quite a few other conversion programs floating around in the public domain world, but here's a simple one you can write and compile yourself *on an MS-DOS system* with one of the better C compilers: /* Copyright 1989 Rahul Dhesi, all rights reserved. Noncommercial use permitted; inquire about commercial use license. */ #include main() {int c; while ((c = getc(stdin)) != EOF) putc(c, stdout);} It works because the stdio library does the newline conversion for you. Use as a filter. -- Rahul Dhesi UUCP: ...!{iuvax,pur-ee}!bsu-cs!dhesi