added functions for unformatted write