C/UNIX low level I/O

David Brown david at pyr.gatech.EDU
Wed Nov 2 07:38:18 AEST 1988


 Hi, NetLanders.  I've a small C/UNIX problem.  I need to do a bunch of
 small write's to a file.  I need to know the quickest way to do it.
 I've got a linked list of 'words' that I need written to a file in a 
 humanly readable and understandable fashion.  But it needs to take as
 little time as possible.  For instance, the way I have it now, I use
 write(2).  But this ay, I do a separate 'write' for every word in the
 list, and a 'write' for the spaces between and the newlines. Like this:
 
        while (list ~empty){
         write word
         write space
        }
        write newline

 My question: is there a better way to do this?  I've thought of using 
 higher-level I/O routines like fprintf, but I think they would be
 less efficient. But less efficient than what I'm doing now?

Thanks,
 David Brown

----------------------------------------------------------------------------
David Brown
Armstrong State College, Savannah, Georgia
uucp: ...!{akgua,allegra,amd,hplabs,uunet,seismo,ut-ngp}!gatech!gitpyr!david
ARPA: david at pyr.gatech.edu



More information about the Comp.unix.questions mailing list