seekg moves the file input pointer(position of reading frm file) while seekp moves file output pointer( position f writing to file).