Path: utzoo!mnetor!uunet!husc6!endor!singer
From: singer@endor.harvard.edu (THINK Technologies)
Newsgroups: comp.sys.mac
Subject: Re: Lightspeed C question
Message-ID: <3522@husc6.harvard.edu>
Date: 11 Dec 87 16:28:18 GMT
References: <13231@beta.UUCP>
Sender: news@husc6.harvard.edu
Reply-To: singer@endor.UUCP (THINK Technologies)
Organization: THINK Technologies, Bedford, MA
Lines: 46
Keywords: printf, stdio, quickdraw, grafport

In article <13231@beta.UUCP> wkp@beta.UUCP (Bill Peter) writes:
>
>
>After just reading my newly-arrived Lightspeed C manual,
>and porting some programs onto the Mac, I noticed that
>the manual seems deficient in many respects.

	Agreed.

>The most serious is that when I open up a grafport to
>use quickdraw routines, everything is fine.  But then
>using printf() causes the mac to write onto a new
>screen (I assume stdio), and makes the program go nuts.
>Since I need to use printf() to output both text and
>floating point numbers, this is incovenient.  I can't
>use DrawString to output floating point numbers (or can I?).
>
>There's functions like Init_Stdio in the compiler, but they
>aren't explained in the manual, and don't seem to help much.
>What to do?  Buy the last 12 issues of MacTutor?  Spend
>long-distance money calling up THINK ?


	Consult the LightspeedC 2.01 release supplement. There's a function
called "Stdio_MacInit()". Pass it the argument TRUE and stdio will not
initalize the Macintosh managers. This call should be made before you do
any stdio calls.

	You don't want to use printf() to output values into an arbitrary
grafPort. The best way would be something like this:

	char *s;
	double d;

	sprintf("\p%lf", d);
	MoveTo(xPos, yPos);
	DrawString(s);

		--Rich

**The opinions stated herein are my own opinions and do not necessarily
represent the policies or opinions of my employer (THINK Technologies).

* Richard M. Siegel | {decvax, ucbvax, sun}!harvard!endor!singer    *
* Customer Support  | singer@endor.harvard.edu			    *
* Symantec, THINK Technologies Division.  (No snappy quote)         *