migrating to c style IO