Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!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: <747@sys.uea.ac.uk> Date: 12 Oct 89 15:18:02 GMT References: <501@dftsrv.gsfc.nasa.gov> <16055@dartvax.Dartmouth.EDU> Organization: UEA, Norwich, UK Lines: 22 (Apologies if you see this twice, teething troubles with nn...) 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 a long time ago (I forget who posted it), and have used it ever since with MPW 2 and 3. I find it saves about 10K of dead code. 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