how to -- buffered read / write to stdio