Xref: utzoo comp.sys.m6809:711 comp.lang.c:8062 Newsgroups: comp.sys.m6809,comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Don't use Scanf() Message-ID: <1988Mar13.005841.12770@utzoo.uucp> Keywords: C stdio library Organization: U of Toronto Zoology References: <2401@ihwpt.ATT.COM> <320@c10sd1.StPaul.NCR.COM> <1185@ucsfcca.ucsf.edu>, <9241@sunybcs.UUCP> Date: Sun, 13 Mar 88 00:58:41 GMT > For example, if you want to print a string fast, you would write > a routine that uses only putc... !!NO!! If you want to print a string fast, you use fputs and insist that your supplier implements it properly. Putc has to do things like buffer- overflow checking on every character; a fast implementation of fputs can inspect the buffer *once*, note that there is room for N more characters, copy N characters at high speed, and then update counts and so forth *once*. This is a major efficiency win over putc if you are doing it a lot. Unfortunately, not all implementors make the effort to make stdio fast. In general, System V stdios are fast and 4BSD ones are not. (There are exceptions to this, both ways, and I believe the 4BSD one is going to be improved.) -- Those who do not understand Unix are | Henry Spencer @ U of Toronto Zoology condemned to reinvent it, poorly. | {allegra,ihnp4,decvax,utai}!utzoo!henry