Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!gem.mps.ohio-state.edu!ginosko!uunet!mcsun!ukc!sys.uea!jrk From: jrk@sys.uea.ac.uk (Richard Kennaway) Newsgroups: comp.sys.mac.programmer Subject: Re: stdin and stdout in MPW C 3.0 Keywords: stdin, stdout, MPW 3.0 Message-ID: <746@sys.uea.ac.uk> Date: 12 Oct 89 12:03:29 GMT References: <501@dftsrv.gsfc.nasa.gov> <16055@dartvax.Dartmouth.EDU> Organization: UEA, Norwich, UK Lines: 20 In article <16055@dartvax.Dartmouth.EDU> earleh@eleazar.dartmouth.edu (Earle R. Horton) writes: ... >formatted input and output. You might think that you can use >sprintf/sscanf to convert things into strings internally, thus >bypassing stdio. However, if you use sprintf or sscanf in your code, >the linker pulls in all of stdio. If you want to save space in your >final application by not linking in stdio, then you cannot even use >the standard string formatting routines. Tough. This isnt quite true. To use sprintf/sscanf without pulling in all of stdio, all you need to do is define empty routines of your own called fwrite(), _flsbuf(), and _filbuf(), and make sure those get linked before stdio. I got this technique from the net some time ago (I forget who posted it), and have used it ever since with MPW 2. I forget just how much dead code you save, somewhere in the region of 5-20 K. Just make sure you dont leave the first character off "sscanf" :-). -- Richard Kennaway SYS, University of East Anglia, Norwich, U.K. Janet: kennaway@sys.uea.ac.uk uucp: ...mcvax!ukc!uea-sys!jrk