so does this mean i would to change the while statement to
do
{

} (buf1 != EOF || buf2 != EOF )

Not sure if iam getting what you are saying
-ali