Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!apple!voder!pyramid!ctnews!starfish!cdold From: cdold@starfish.Convergent.COM (Clarence Dold) Newsgroups: comp.sys.ibm.pc Subject: Re: Text file conversion between UNIX and MSDOS Message-ID: <940@starfish.Convergent.COM> Date: 14 Feb 89 19:19:25 GMT References: <6489@hoptoad.uucp> Distribution: na Organization: Convergent Technologies, San Jose, CA Lines: 22 From article <6489@hoptoad.uucp>, by pozar@hoptoad.uucp (Tim Pozar): > noworol@eecg.toronto.edu (Mark Noworolski) wrote: >> 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. With Microsoft C on MSDOS, their concept of a text file allows for rather simple translation from UNIX to MSDOS: open the file, fgets a line, fputs a line. The output is an MSDOS CR/LF file. If you run the program again, magic!, no change. Apparently, in 'text' mode, Microsoft C accepts LF-delimited lines, but always writes CR/LF-delimited lines. A snippet of code: while ((fgets(inline,LINESZ,input)) != NULL ){ fputs(inline,stdout); } -- Clarence A Dold - cdold@starfish.Convergent.COM (408) 434-2083 ...pyramid!ctnews!professo!dold MailStop 18-011 P.O.Box 6685, San Jose, CA 95150-6685