Replace fstream with stdio