Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!spool.mu.edu!uwm.edu!vixen.cso.uiuc.edu!ais.net!news.maxwell.syr.edu!eerie.fr!cnusc.fr!ciril.fr!univ-angers.fr!jussieu.fr!oleane!weld.news.pipex.net!pipex!warm.news.pipex.net!pipex!tank.news.pipex.net!pipex!news.utell.co.uk!usenet From: brian@shift.utell.net (Brian Somers) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: dos2unix Date: 17 Jun 1997 09:04:53 GMT Organization: Awfulhak Ltd. Lines: 36 Message-ID: <5o5jvl$bmt@ui-gate.utell.co.uk> References: <339E506B.D46@slt.lk> <01bc7ac1$88ea1410$32327881@wingdog> Reply-To: brian@awfulhak.org, brian@utell.co.uk NNTP-Posting-Host: shift.utell.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Newsreader: knews 0.9.8 Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:43019 In article <01bc7ac1$88ea1410$32327881@wingdog>, "Charles Tilbury" <ctilbury@infohwy.com.REMOVE.JUNK> writes: > > #include <stdio.h> > void main(int argc, char **argv) { > FILE *infp, *outfp; > int bytes_read; > char buffer[1024]; > > if((infp = fopen(argv[1], "rt")) == NULL) { ^ TYPO :O > perror("Cannot open infile:"); > return; > } > > if((outfp = fopen(argv[2], "wb")) == NULL) { > perror("Cannot open outfile:"); > return; > } > > while(1) { > if((bytes_read = fread(buffer, 1, 1024, infp)) != 0) > fwrite(buffer, 1, bytes_read, outfp); > else > break; > } > fclose(infp); > fclose(outfp); > } -- Brian <brian@awfulhak.org> <brian@freebsd.org> <http://www.awfulhak.org> Don't _EVER_ lose your sense of humour !