[comp.sys.atari.st] Can GCC treat printer like file?

timothyg@ncsa.uiuc.edu (Timothy Gallivan) (04/20/91)

Hi, here is a question for a real C guru.

Does anyone know if gcc can treat the printer like a file? That is,
obtain a file descriptor for the printer (fd=fopen(stdprn,..), or
something like that), and then write to it using fwrite(...,fd) or
putc(fd). I am aware of the TOS print routines, but I am trying to
port some MSDOS code which treats the printer like a file. The port
will be easier if I cam mimic this in gcc.

-Tim Gallivan
National Center for Supercomputing Applications
University of Illinois
timothyg@ncsa.uiuc.edu

 

marc@sequoia.cray.com (Marc Bouron) (04/22/91)

In article <1991Apr19.200801.26887@ux1.cso.uiuc.edu>, timothyg@ncsa.uiuc.edu (Timothy Gallivan) writes:
|> 
|> Hi, here is a question for a real C guru.
|> 
|> Does anyone know if gcc can treat the printer like a file? That is,
|> obtain a file descriptor for the printer (fd=fopen(stdprn,..), or
|> something like that), and then write to it using fwrite(...,fd) or
|> putc(fd). I am aware of the TOS print routines, but I am trying to
|> port some MSDOS code which treats the printer like a file. The port
|> will be easier if I cam mimic this in gcc.
|> 
There is a standard filename called `PRN:' or `LST:' that you should be able to
use just like any other filename.  TOS recognises this filename and directs the
output to the printer.  For example, you would write fopen("LST:","w").  You'll
need to check yourself which one works... one is standard TOS - the other was a
Lattice special.

[M][a][r][c]


################################################################################
#                           #  marc@sequoia.cray.com           #     .   .     #
#  Marc CR Bouron           #  M.Bouron@cray.co.uk     (ARPA)  #    _|\ /|_    #
#  Cray Research (UK) Ltd.  #  M.Bouron@crayuk.uucp  (DOMAIN)  #   (_|_V_|_)   #
#  +44 344 485971 x2208     #  M.Bouron@uk.co.cray    (JANET)  #     |   |     #
#                           #  ...!ukc!crayuk!M.Bouron (UUCP)  #               #
################################################################################

ljdickey@watmath.waterloo.edu (L.J.Dickey) (04/26/91)

In article <032147.3514@timbuk.cray.com> marc@sequoia.cray.com
	(Marc Bouron) writes:
>
>In article <1991Apr19.200801.26887@ux1.cso.uiuc.edu>, timothyg@ncsa.uiuc.edu
	(Timothy Gallivan) writes:
 > ...
 > There is a standard filename called `PRN:' or `LST:' that you should be
 > able to use just like any other filename.  TOS recognises this filename
 > and directs the output to the printer.  For example, you would write
 > fopen("LST:","w").  You'll need to check yourself which one works...
 > one is standard TOS - the other was a Lattice special.


Is there a standard filename for the serial port?

-- 
Prof L.J. Dickey, Faculty of Mathematics, U of Waterloo, Canada N2L 3G1
	Internet:	ljdickey@watmath.waterloo.edu
	UUCP:		ljdickey@watmath.UUCP	..!uunet!watmath!ljdickey
	X.400:		ljdickey@watmath.UWaterloo.ca

marc@sequoia.cray.com (Marc Bouron) (04/26/91)

In article <1991Apr26.044146.19629@watmath.waterloo.edu>, ljdickey@watmath.waterloo.edu (L.J.Dickey) writes:
|> In article <032147.3514@timbuk.cray.com> marc@sequoia.cray.com
|> 	(Me!! :-) ) writes:
|> >
|> >In article <1991Apr19.200801.26887@ux1.cso.uiuc.edu>, timothyg@ncsa.uiuc.edu
|> 	(Timothy Gallivan) writes:
|>  > ...
|>  > There is a standard filename called `PRN:' or `LST:' that you should be
|>  > able to use just like any other filename.  TOS recognises this filename
|>  > and directs the output to the printer.  For example, you would write
|>  > fopen("LST:","w").  You'll need to check yourself which one works...
|>  > one is standard TOS - the other was a Lattice special.
|> 
|> 
|> Is there a standard filename for the serial port?

Try "AUX:".  Also, "CON:" for the console.

[M][a][r][c]


################################################################################
#                           #  marc@sequoia.cray.com           #     .   .     #
#  Marc CR Bouron           #  M.Bouron@cray.co.uk     (ARPA)  #    _|\ /|_    #
#  Cray Research (UK) Ltd.  #  M.Bouron@crayuk.uucp  (DOMAIN)  #   (_|_V_|_)   #
#  +44 344 485971 x2208     #  M.Bouron@uk.co.cray    (JANET)  #     |   |     #
#                           #  ...!ukc!crayuk!M.Bouron (UUCP)  #               #
################################################################################

entropy@gnu.ai.mit.edu (entropy) (04/27/91)

In article <1991Apr26.044146.19629@watmath.waterloo.edu> ljdickey@watmath.waterloo.edu (L.J.Dickey) writes:

>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.

entropy
--
			  entropy@gnu.ai.mit.edu
	entropy. . .it's not just a good idea, it's the second law.
     Boycott Lotus, Apple, Ashton-Tate and Xerox.  Join the League for
Programming Freedom!  Write to league@prep.ai.mit.edu for more information.

heavy@zip.eecs.umich.edu (Richard Scott Hall) (04/28/91)

In article <ENTROPY.91Apr26203035@wookumz.gnu.ai.mit.edu> entropy@gnu.ai.mit.edu (entropy) writes:
>In article <1991Apr26.044146.19629@watmath.waterloo.edu> ljdickey@watmath.waterloo.edu (L.J.Dickey) writes:
>
>>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.
>
>entropy

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
-- 

Standard disclaimer:  I am not me, I am who you think you are...
                      so don't blame me.

adamd@rhi.hi.is (Adam David) (05/02/91)

In <1991Apr26.044146.19629@watmath.waterloo.edu> ljdickey@watmath.waterloo.edu (L.J.Dickey) writes:

[discussion of PRN: LST: AUX: CON: etc. deleted]

>Is there a standard filename for the serial port?

Try stdaux, some compilers reserve that name for the serial port. Don't know
about gcc though.

--
Adam David.  (adamd@rhi.hi.is)