Article View: comp.sys.mac
Article #22142Re: Lightspeed C question
From: Robert B. Stam
Date: Wed, 16 Dec 1987 21:11
Date: Wed, 16 Dec 1987 21:11
26 lines
1480 bytes
1480 bytes
In article <3522@husc6.harvard.edu> singer@endor.UUCP (THINK Technologies) writes:
> 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
>
Just in case someone is going crazy trying to make this work, watch out
for what is surely just a typo in the above code. The call to sprintf
is wrong; the whole thing should look like:
sprintf (s, "%lf", d); /* format string must be "C" string */
CToPString (s); /* convert to Pascal string (fn name right?) */
MoveTo (xPos, yPos);
DrawString (s);
Robert B. Stam CSNET: stamr@unc.cs.unc.edu
UNC Computer Science Department ARPA: stamr%unc@mcnc.org
Sitterson Hall 083A UUCP: {ihnp4|decvax}!mcnc!unc!stamr
Chapel Hill, NC 27514 Phone: (919) 962-1826
Technical Details
Message-ID:
<428@thorin.cs.unc.edu>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!decvax!mcnc!thorin!magnolia!stamrReferences:
<13231@beta.UUCP> <3522@husc6.harvard.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!decvax!mcnc!thorin!magnolia!stamr From: stamr@magnolia.cs.unc.edu (Robert B. Stam) Newsgroups: comp.sys.mac Subject: Re: Lightspeed C question Message-ID: <428@thorin.cs.unc.edu> Date: 16 Dec 87 21:11:11 GMT References: <13231@beta.UUCP> <3522@husc6.harvard.edu> Sender: news@thorin.cs.unc.edu Reply-To: stamr@magnolia.UUCP (Robert B. Stam) Organization: University Of North Carolina, Chapel Hill Lines: 26 Keywords: printf, stdio, quickdraw, grafport