Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hp-ses!hpcuhb!hpindda!hardin From: hardin@hpindda.HP.COM (John Hardin) Newsgroups: comp.sys.ibm.pc Subject: Re: Text file conversion between UNIX and MSDOS Message-ID: <40970002@hpindda.HP.COM> Date: 10 Feb 89 17:30:14 GMT References: <89Feb9.123853est.2662@godzilla.eecg.toronto.edu> Organization: HP Information Networks, Cupertino, CA Lines: 44 noworol@eecg.toronto.edu (Mark Noworolski) writes: >Very frequently when I get stuff off the net I run into the problem of >no carriage returns. It appears that UNIX stores text a little differently >from Messdos. > >Bafore writing something to fix this problem... I figure somebody's probably >already done it. ---------- I wrote the following program to do just that: #include #include main() { int ch; ch = getchar(); while (ch != EOF) { putchar(ch); ch = getchar(); } } This was written in Turbo C 1.5, but I doubt that other compilers would have a problem with it (famous last words?). For compatibility with Unix, the putchar function adds a CR when you output an LF, so all you have to do is read the input file and write the output file, ignoring the Unix/DOS difference. If you compile and link the above to unix2dos.exe, then to run it just type unix2dos dosfile (substituting your own file names, of course). John Hardin hardin%hpindda@hplabs.hp.com -----------