move file IO functions from misc2.c to fileio.c