make buffer_ local to the doread() function and implement data pass