switched to cstdio for file validation