Switch to using freopen, add tests for basic fileio
Adding some more tests