Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!prlb2!kulcs!kulesat!esat!bartels From: bartels@haydn.kulesat.uucp Newsgroups: comp.sys.mac.programmer Subject: Using printf with MPW-C for output to terminal Summary: I must implement a package with many printf's from Vax to MacII Message-ID: <1039@haydn.kulesat.uucp> Date: 12 Apr 89 14:56:39 GMT Reply-To: bartels@kulesat.uucp Organization: Katholieke Universiteit Leuven,ESAT - dep. Elect. Engineering, Belgium Lines: 72 I must implement a big package existing in C on a Vax to the Macintosh. Now the biggest problem is that MPW-C doesn't support printf to the console. I tried to define a global window and to redirect the output (stdout (filedes = 1)) to the global window. You will see mine pogram below. It just doesn't work. A second way to solve the problem is to redefine the printf with sprintf and drawtext but than I must control scrolling in the window, .... Who knows waths the best solution? #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include typedef BitMap *BitMapPtr; #define windowID 1000 /* Resource ID for main window */ main() { CWindowPtr ImagePort; Rect Imagerect; long int refCon; CWindowRecord wRecord; long arg; InitGraf(&qd.thePort); InitFonts(); InitWindows(); InitMenus(); TEInit(); InitDialogs(nil); InitCursor(); SetRect(&Imagerect,40,40,350,350); ImagePort = (CWindowPtr) NewCWindow((Ptr) &wRecord,&Imagerect,"\pMessagewindow",1, documentProc, (WindowPtr) -1 ,0,refCon = 4); arg = (long) ImagePort; ioctl(1,TIOSPORT,&arg); printf(" message"); while(! Button()); } If you know a good solution please send me. Thanks for your attention, Yours sincerly, Rudi Bartels KU Leuven Faculteit der Toegepaste Wetenschappen ESAT-MI2 Kard. Mercierlaan 94 3030 Heverlee Belgium email: bartels@kulesat.uucp Fax: 32-16-221855