mentat@auscso.UUCP (Robert Dorsett) (08/20/87)
Another question I had on Lightspeed C is its capability (if any) to permit the user to write program text in all lower-case. I find mixed case to be a royal pain in C, in general, and prefer to write in lower case. -- Robert Dorsett {allegra,seismo}!sally!ngp!walt!mentat University of Texas at Austin {allegra,seismo}!sally!ngp!mentat mentat@ausco.UUCP
wkp@beta.UUCP (Bill Peter) (12/11/87)
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. 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 ?
singer@endor.harvard.edu (THINK Technologies) (12/12/87)
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) *
shane@pepe.cc.umich.edu (Shane Looker) (12/12/87)
In article <13231@beta.UUCP> wkp@beta.UUCP (Bill Peter) writes: > [ Talking about LSC ] >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 is a file in the Info-Mac archives on SUMEX called [SUMEX-AIM.Stanford.EDU]<INFO-MAC>UTILITY-LSC-DEBUGGING.HQX which creates a window for debugging purposes which takes calls in the printf form. If you can't get to SUMEX, I can get the file to you somehow. Shane Looker | "He's dead Jim, shane@pepe.cc.umich.edu | you grab his tricorder, uunet!umix!pepe.cc.umich.edu!shane | I'll get his wallet." Looker@um.cc.umich.edu
conybear@moncsbruce.oz (Roland Conybeare) (12/14/87)
In article <13231@beta.UUCP>, wkp@beta.UUCP (Bill Peter) writes: > > ...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?)... I don't know what your Mac background knowledge is. It sounds like you need to get Inside Macintosh, from Apple or a bookstore (If you like looking at trees). From what you have said, I think your problem is that between a call to printf() in a stdio window and a call to quickdraw in your own grafport, you must call SetPort() since when printf() returns the stdout window is the current window. Roland Conybeare (conybear@moncsbruce.oz)
stamr@magnolia.cs.unc.edu (Robert B. Stam) (12/17/87)
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