Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!spool.mu.edu!uwm.edu!bionet!apple!ksand From: ksand@Apple.COM (Kent Sandvik) Newsgroups: comp.sys.mac.programmer Subject: Re: MPW 3.1 C stdio question(s) Message-ID: <49788@apple.Apple.COM> Date: 1 Mar 91 23:49:22 GMT References: <1991Mar1.030623.9398@cs.rochester.edu> Organization: Apple Computer Inc., Cupertino, CA Lines: 48 In article <1991Mar1.030623.9398@cs.rochester.edu> miller@cs.rochester.edu writes: >Hi, > >I'm trying to get a couple of UNIX-type programs up under the MPW >shell. Nothing *too* bizzare, but I can't seem to get much working... >in particular I need to do raw i/o to the console, and send control >information as well (e.g. clear to end of line, move cursor, etc.). >Similar to the CONSOLE library in THINK C, or the CURSES package in >unix. > >But I'm stuck. Not only isn't there any console control defined in >the C or MPW manuals (if there is, please point me to it!), but something >simple like > >main (){ > setbuf(stdin, NULL); > setbuf(stdout, NULL); > while (getchar() != NULL){ > putchar('x'); > } >} > >compiled and linked to be a tool, I'd expect on running it that every >char I type would cause an x to be printed, but actually the input is echoed >and nothing is printed until I do command-ret. when I get a single 'x'. The standard I/O is buffered by default, so you don't get anything before you do a fflush (e.g. fflush(stdio); ). MPW 3.2 will contain a library of standard I/O routines which makes it possible to fast hack simple standalone binaries (not MPW tools) which use standard I/O procedures. It's called SIOW. Last time I checked the beta releases it even had default code for printing and clipboard support. As for a ported curses library to MPW, I don't know of any. I do know that the curses libraries have been ported to the Think-C environment, as part of the nethack port. John V{tte or someone else should know the story behind that one. Kent 'Skonk' Sandvik -- Kent Sandvik, Apple Computer Inc, Developer Technical Support NET:ksand@apple.com, AppleLink: KSAND DISCLAIMER: Private mumbo-jumbo Zippy++ says: "C++ was given to mankind, so that we might learn patience"