added fo.c
moved file operations to fo.c