Path: 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 I am having a strange problem with I/O redirection. To redirect standard output to the printer, I wrote the following test program: #include #include /* 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