Max,
use the following algo for ur work: create 2 hash-tables for good and bad addresses. the keys are the domain part of the e-mail addresses. the value part is the reference to an array of id part of the e-mail address. instead of reading data into ur GOOD and BAD fd's , read them in the above hashes. from here, after processing is completed, read them into the associated files. here u r saving the disk i/o time as u are flushing data once for each file. also using hash, u r saving the RAM space for the domain part of the e-mail address. --------------------------------- Get a bigger mailbox -- choose a size that fits your needs. http://uk.docs.yahoo.com/mail_storage.html