[comp.sys.mac.programmer] printf and logs in THINK C 4.0

bwb@andante.UUCP (Bruce Ballard) (08/25/89)

I'd like to use printf and log-base-2 in THINK C 4.0. My concerns are:

1. When I use printf, some keyboard events don't get reported to my
   program. I had been doing
   
   		GetNextEvent (keyDownMask, &theEvent)
   	
   in my printing loop to look for "." pressed with the command key
   so I could cancel printing. Unlike with version 3.0, some part of
   the ANSI library in 4.0 detects this keystroke: if it's printing at
   the time, it quits my application, otherwise it just beeps.
   My work-around so far is to use GetKeys. How can/should I be doing this?
   (It also seems that command-key equivalents don't work when printf's
   console window is up. Argh.)

2. I need to find log base 2, but there only seem to be natural log
   and log base 10. It's trivial to convert from one to another by
   a simple multiplication, but I see that the code in math.c does
   
		static double Log2Ten = 3.321928094887362348;
		...
  		elems68k(&x, FLOG2X);	/* LOG2 is much faster than LN */
		x /= Log2Ten;

   Clearly I would settle for the elems68k call, since it has just
   what I want: can I get to it? I spent a while looking through the
   documentation and poking through source code but I can't find it.

Thanks in advance to any helpers out there.

-Bruce Ballard
bwb@allegra.att.com