Path: utzoo!dciem!nrcaer!scs!spl1!laidbak!att!pacbell!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!unisoft!gethen!doug From: doug@gethen.UUCP (Doug Asherman) Newsgroups: comp.sys.ibm.pc Subject: Re: C write() operations to MS-DOS devices? Message-ID: <922@gethen.UUCP> Date: 2 Jun 88 07:15:43 GMT Article-I.D.: gethen.922 References: <1318@tahoe.unr.edu> <875@dsacg3.UUCP> Reply-To: doug@gethen.UUCP (Doug Asherman) Organization: There's Unix there in Oakland Lines: 28 In article <875@dsacg3.UUCP> nts0302@dsacg3.UUCP (Bob Fisher) writes: >In article <1318@tahoe.unr.edu>, malc@tahoe.unr.edu (Malcolm L. Carlock) writes: >> >> How can I do a C write() operation to MS-DOS device PRN, AUX, etc. ? >> > >Try using the pathnames ":PRN", ":CON" and ":AUX" when you open the file. If you do do a "write" to the printer, don't forget to set the mode of the printer to "text". Otherwise you'll end up with a document full of line feeds, but no carriage returns. Or is it the other way around? Oh, well, one of those... If you're using MSC, you can do this two ways: 1) fopen("PRN","wt"); clunky, but it works. 2) setmode(stdprn,O_TEXT); The second method is, I believe, a little better, and you won't have to explicitly open stdprn since it's already open. Come to think of it, if you're going to do a write() anyway, you'll want to use setmode, since write takes a file handle as an argument and stdprn is a pre- defined file handle. -- Current Address: : "You keep using that word- : I do not think it means { sun, ptsfa } : what you think it means." !hoptoad!unisoft!gethen!doug : -William Goldman