Path: utzoo!mnetor!uunet!husc6!cmcl2!nrl-cmf!ames!amdahl!drivax!socha From: socha@drivax.UUCP (Henri J. Socha (7-x6628)) Newsgroups: comp.sys.mac Subject: Re: Using Printer with LSC Message-ID: <3188@drivax.UUCP> Date: 10 Mar 88 23:44:58 GMT References: <9847@steinmetz.steinmetz.UUCP> Reply-To: socha@drivax.UUCP (Henri J. Socha (7-x6628)) Organization: Digital Research, Monterey, CA Lines: 44 Keywords: LSC, printer In article <9847@steinmetz.steinmetz.UUCP> leue@galen.UUCP (Bill Leue) writes: >I have been successful in getting >output to the printer, but cannot get the paper to advance. >#include "stdio.h" >FILE *pfile; >pfile = fopen(".BOut", "a"); >fprintf(pfile, "Hello, World\n"); >fprintf(pfile, "This is the next line\n"); >fclose(pfile); >The symptoms are that all the output is printed, but each succeeding >line of text overwrites the last one -- that is, the paper never advances. > * replacing the "\n" with "\012\015" >Nothing works. Any suggestions? >-Bill Leue If I may, I've send stuff about similar problems on the net before and I even had it but in neither case was it printer related. But, the symptoms fit so: The fopen uses "a" mode. This is not BINARY ouput and should be something like "ab" (but I'm not positive about that second character my manuals and Mac are not here.) The problem that in text mode somewhere deep inside the C runtime library there is a test which goes something like (NOTE: I'm totally paraphrasing): if ((c == '\n') && !(mode && BINARY)) c = '\r' Now I may have the \n and \r backwards but I think you get the idea. The reason you see no line feeds is that the stdio library is converting those line feeds into carriage returns! This is the standard for Mac text files but not printers. So, try mode "ab" (or whatever that letter is). I hope this helps. -- UUCP:...!amdahl!drivax!socha WAT Iron'75 "Everything should be made as simple as possible but not simpler." A. Einstein