[comp.sys.atari.st] I/O redirection and Cconout

jtr485@umich.UUCP (03/17/87)

I have been working with some code to redirect I/O using the GEMDOS
Fdup(STDOUT) and Fforce(STDOUT,fd) routines.  However, If I redirect
to a disk file then Cconout(c) calls give me 2 bombs (nee mushrooms,
i.e. BUS ERROR).  Everything works fine with code which uses Cconws(s)
calls.  The files are created and they always contain at least one
character (garbage).  In some cases a lot of Cconout() calls can take
place before the bus error and there is one garbage character per
Cconout() call.  My speculation would be that somewhere there is a
reference to a not properly defined buffer being made.

I have some code generated with a lattice compiler using printf() calls.
If I redirect output and then run this program it has the same behavior.
I assume this means the lattice i/o routines are using Cconout().  That
means it won't be sufficient, in my analysis, to just not use Cconout().

I need a run time solution.  I can visualize a little trap routine
intercepting all gemdos calls and mapping Cconout() calls to Cconws()
calls with a local 2 byte buffer.

Is there a better solution?
Is this a problem people know about?
Is it a problem with my ROMs only?

I haven't tried this code with Tos in ram.  I will do so now that I have
thought of it.

--j.a.tainter