[comp.sys.mac.programmer] THINK C FILE Structure

Chris.Gehlker@p12.f56.n114.z1.fidonet.org (Chris Gehlker) (11/20/90)

For reasons of portability I want to write to the Serial ports
using fwrite().  It looks as if I can do it if I can initialize
a FILE correctly.  In THINK C 4.0.2, FILE is defined as:

typedef struct {
unsignedstd : 1;
unsignedbinary : 1;
unsignedeof : 1;
unsignederr : 1;
unsigneddirty : 1;
unsignedmybuf : 1;
unsignedappend : 1;
unsigneddelete : 1;
unsignedpushed : 1;
charone;
unsigned charpushc;
shortrefnum;
char*buf;
size_tsize;
unsigned char*ptr;
size_tcnt;
fpos_tpos;
fpos_tlen;
void*window;
int(*proc)();
} FILE;

Now refnun looks like it should be assigned the value that
I get from OpenDriver() but how should I initialize the
rest of this stuff?

 

--  
Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!56.12!Chris.Gehlker
Internet: Chris.Gehlker@p12.f56.n114.z1.fidonet.org

oster@well.sf.ca.us (David Phillip Oster) (11/24/90)

To initialize a THINK C file structure to talk to the modem port say:
fopen(".AOut", "w"); fopen(".BIn", "r");
the printer port is ".BOut" and ".BIn" respectively. The resulting MacO.S.
refnums can be fetched up out of the structure to do Mac O.S. serial settings
calls. (since you have to call the Mac O.S. anyway, you might as well just
write it as a Mac program and forget about stdio). Case is significant.
These ports default to 9600 Baud, 8 data bits, no parity, 1 stop bit.
-- 
-- David Phillip Oster - At least the government doesn't make death worse.
-- oster@well.sf.ca.us = {backbone}!well!oster