Article View: comp.sys.atari.st
Article #39555I/O redirection to the printer
From: "Thomas Koenig"
Date: Sat, 16 Dec 1989 03:19
Date: Sat, 16 Dec 1989 03:19
53 lines
2287 bytes
2287 bytes
I am having a strange problem with I/O redirection. To redirect
standard output to the printer, I wrote the following test program:
#include <stdio.h>
#include <tos.h> /* Turbo - C 's header for TOS stuff */
main()
{
int oldstd;
int printhandle;
oldstd = Fdup (1);
printhandle = Fdup (3);
printf("oldstd = %d, printhandle = %d\n",oldstd,printhandle);
Fclose (1);
Fforce (1, printhandle);
printf("Hello, world!\n");
/* Cconws("Hello, world!\n"); */
Fclose (1);
Fforce (1, oldstd);
Fclose (oldstd);
Fclose (printhandle);
}
This program worked as it should; it printed out
Hello, world!
on the printer. However, when I commented out the printf statement
and used Cconws instead, it seemed to go into an endless loop; I
could still move the mouse around, but that was it for at least 10
minutes (I did not wait any longer). Oh, by the way, the printer WAS
online and ready. Without the I/O redirection, Cconws worked fine;
it printed out "Hello, world" on the screen. No accessories or
memory resident programs were active at the time.
The problem with Cconws occured both with Turbo C V1.1 and with
equivalent code (calls to the GEMDOS library) in SPC Modula V2.0.
I am using a Mega ST2 with TOS 1.2 (1.4 has not made it here yet) and
a Megafile 60 hard drive.
Is there something wrong with my code (but WHY did printf work,
then?), can anybody reproduce this strange behaviour, is this a bug
in TOS 1.2 which has/has not been fixed in TOS 1.4, ... , in short:
WHAT IS GOING ON?
Any help appreciated.
Thomas Koenig UI0T@DKAUNI2.BITNET
UI0T%DKAUNI2.BITNET@CUNYVM.CUNY.EDU
(soon: new address, old machine) UI0T@IBM3090.RZ.UNI-KARLSRUHE.DBP.DE
'Ich dachte nicht, ich untersuchte.' Wilhelm Conrad Roentgen
Technical Details
Message-ID:
<"89-12-15-19:19:25.76*UI0T"@DKAUNI2.BITNET>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!wuarchive!decwrl!ucbvax!DKAUNI2.BITNET!UI0TShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!wuarchive!decwrl!ucbvax!DKAUNI2.BITNET!UI0T
From: UI0T@DKAUNI2.BITNET ("Thomas Koenig")
Newsgroups: comp.sys.atari.st
Subject: I/O redirection to the printer
Message-ID: <"89-12-15-19:19:25.76*UI0T"@DKAUNI2.BITNET>
Date: 16 Dec 89 03:19:00 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The Internet
Lines: 53