Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!caen!sol.ctr.columbia.edu!ira.uka.de!smurf!artcom0!hb.maus.de!do.maus.de!Martin_Koehling From: Martin_Koehling@do.maus.de (Martin Koehling) Newsgroups: comp.sys.atari.st Subject: Re: Can GCC treat printer like Message-ID: <1912@do.maus.de> Date: 5 May 91 19:10:00 GMT Distribution: world,comp Organization: Maus Mailbox Netz - UUCP-Gateway Bremen Lines: 46 Richard Scott Hall heavy @ zip.eecs.umich.edu wrote: <1991Apr27.171053.29034@zip.eecs.umich.edu> >>>Is there a standard filename for the serial port? >> >>AUX: >> >>For a full list, check the guide to Atari BASIC that should have come >>with your ST, I think it's in there somewhere. >> > >I have tried this in GCC, but I get a NULL FILE pointer >when I do an fopen() on it...I am not too sure it works >unless I did something wrong... > >Richard Hall >University of Michigan When you tell GEMDOS to Fopen("AUX:",2 /*read/write*/), it will return 0x0000fffeL. This is the "device handle" for the serial port; it's WORD-negative, but LONG-positive (BTW: this is _not_ the same as handle 2, which can be redirected; device handles can't be redirected !). I think that GCC's fopen() mistakes this for an error code. Most (if not all) GEMDOS function return LONGs; in particular, the Fopen() and Fcreate() system calls should always be treated as returning a LONG. GCC's Fopen should do something like this: long err ; int handle ; err = Fopen(fname,2) ; if ( err < 0 ) { return (FILE*)0 ; /* ... open error ... */ } else { handle = (int)err ; } I suggest you try to find & fix it in the lib sources... Martin Koehling