buffered read and write files