[comp.sys.mac.programmer] Help using console routines in ThinkC

dburr@sandstorm.berkeley.edu (Donald Burr) (04/26/91)

I converted a Lex file to C source on UNIX, and ported it into a Mac environ-
ment.  I designed a front-end for it using Prototyper (Mac interface, and
all that).  Basically, I have it set up so that the Prototyper portion of
the code has a "main()" routine that checks for OS events, does Mac-like
things (menus, dialogs, etc.).  then, if you choose a menu item, it should
jump into the Lex portion (I renamed the 'main()' of the lex file to some-
thing else (lex(), for example)) and I have it so that if the user selected
that menu item, it just goes "lex()" and calls into the lex portion of the
code.  However, at present, it only takes input from the keyboard and dis-
plays output to the screen (using the Think C standard "console").

Is there a way I can get the user to choose if he wants input from a file
and where to direct output to (console or file)?  Example code would be
greatly appreciated!  If you want to see a copy of what I've got so far,
I can binhex and mail you copies of the source.

I'm not that experience when it comes to Mac programming (i'm still sorta new
at this), so please try not to get too technical. :)

- don
===============================================================================
Donald Burr, Univ. of California,Berkeley | America Online: DonaldBurr
INTERNET: dburr@ocf.Berkeley.EDU          |_Compu$erve:_72540,3071_____________
      or: 72540.3071@compuserve.COM       |    "Send flames to /dev/null."

d88-jwa@byse.nada.kth.se (Jon W{tte) (04/27/91)

In article <> dburr@sandstorm.berkeley.edu (Donald Burr) writes:

   I converted a Lex file to C source on UNIX, and ported it into a Mac
   environment.  I designed a front-end for it using Prototyper (Mac

   Is there a way I can get the user to choose if he wants input from a file
   and where to direct output to (console or file)?  Example code would be

THINK C manual, Standard Libraries Reference, page 171.

You _should_ redefine the input and output macros in the lexed file
to call functions you define, though. They should most probably use
MacOS functions - TextEdit for kbd input or HOpen/FSRead for files.

--
						Jon W{tte
						h+@nada.kth.se
						- Power !