Xref: utzoo comp.sys.m6809:719 comp.lang.c:8209 Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!necntc!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.sys.m6809,comp.lang.c Subject: Re: Don't use Scanf() Message-ID: <2980@haddock.ISC.COM> Date: 15 Mar 88 19:33:20 GMT References: <2401@ihwpt.ATT.COM> <320@c10sd1.StPaul.NCR.COM> <1185@ucsfcca.ucsf.edu> <9241@sunybcs.UUCP> <1140@csun.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 19 Keywords: C stdio library In article <1140@csun.UUCP> sef@csun.UUCP (Sean Fagan) writes: >printf("Hello world!\n") is slower than puts("Hello world!") which is slower >than write(1,"Hello world!\n",13). Using write() instead of the stdio routines is not necessarily a win, because non-UNIX systems may still have to fiddle with e.g. NL vs. CRLF conversions. Also note that (even on UNIX) the buffering which is usually done in stdio may let you write everything with a single system call; this can make stdio faster than multiple calls to write(). >For the most part, I don't include in my programs at all; printf >doesn't need it, and I can get by with write very easily. I once used a compiler that let me use stdin, stdout, stderr without including . I included it anyway, because I knew that omitting it was not portable. If your implementation lets you use printf without , fine, but don't complain too loudly if you try to port your code and it suddenly stops working. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint