Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!oliveb!pyramid!prls!philabs!ttidca!woodside From: woodside@ttidca.TTI.COM (George Woodside) Newsgroups: comp.sys.atari.st Subject: Re: putchar() getchar() problem? Keywords: extra CR's, MWC Message-ID: <4914@ttidca.TTI.COM> Date: 27 Jul 89 13:25:13 GMT References: <2829@tahoe.unr.edu> Reply-To: woodside@ttidcb.tti.com (George Woodside) Distribution: usa Organization: Citicorp/TTI, Santa Monica Lines: 23 In article <2829@tahoe.unr.edu> mikew@wheeler.UUCP (Mike Whitbeck) writes: >HELP ! >I seem to get extra \r's from putchar()!!!! (or getchar()?) >I am using MWC 3.0 to port BR's splay compression program to the >ST. The program works fine under UNIX(SUN) and IDRIS (PE7300) >but on the ST I get extra 0x0D's (\r) in the output! This is speculative, but I haven't seen any other suggestions: putchar and getchar are macros. They expand to putc(c,stdout) and getc(stdin), respectively. Both stdin and stdout are already opened as ASCII files when your program begins execution. The insertion of 0x0D into your data streams is most likely due to the high level handler attempting to add a carriage return (0x0D) when it sees a line feed (0x0A) in the stream. You can eliminate this by opeing binary input and output files (use "rb" or "wb" as the second parameter in the fopen() call), and use the putc and getc calls directly with the appropriate file handle. -- *George R. Woodside - Citicorp/TTI - Santa Monica, CA *Path: ..!{philabs|csun|psivax}!ttidca!woodside