Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!deccrl!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!uos-ee!ee.surrey.ac.uk!R.Smithers From: R.Smithers@ee.surrey.ac.uk (Russell Smithers) Newsgroups: comp.lang.c Subject: re: Novice C Message-ID: <1991May21.110609.10231@EE.Surrey.Ac.UK> Date: 21 May 91 11:06:09 GMT Sender: news@EE.Surrey.Ac.UK (Usenet News Service) Reply-To: R.Smithers@ee.surrey.ac.uk (Russell Smithers) Organization: University of Surrey, Guildford, England GU2 5XH. Lines: 57 I would normaly e-mail directly to people but in this case I could not as the mail address i used was wrong and by that time I had quit that group on xrn and could not find another suitable address so heres my answer: Heres a program I wrote to do the same thing ill convert it to work with arrays if you want : #include #include main() { char tst; int mat=1; while((tst=getchar())!=EOF) { /* 13 being ^M */ if (tst==13) printf ("\n"); else printf ("%c",tst); } } Basicly what this program does is to read from stdin a character at a time and looks for ^M if it finds one then it prints to stdout the "\n"(carriage return) (this being what is should be, however if you want to replcae this (^M) with a space heres the code : #include #include main() { char tst; int mat=1; while((tst=getchar())!=EOF) { /* 13 being ^M */ if (tst==13) printf (" "); else printf ("%c",tst); } } PS No flames. Russell Smithers, Computing Assistant, Dept. of Mathematical and Computing Sciences University of Surrey, Guildford, Surrey GU2 5XH, England R.Smithers@cs.surrey.ac.uk +483 571281 x2659 Shock me put on your black leather!!