My function isn't quite working

This function isn't quite working
It should allow you to put text in a file, send
the pointer back to 0, and overwrite whatever information was already there
this is what I have so far


1
2
3
4
void SetPutPointer(std::ostream & fout, int location)
{
	fout.tellg(location,std::ios::end);//put text in the file at the location the call specifies
}
Last edited on
tellg is used to read the position. Use seekp if you want to set the position.
Also tellg, seekp and most other file position functions use a streampos type not an int. A streampos type is a system/compiler defined type large enough the hold the offset to any location within the file, an int is usually not large enough to hold all the possible values.
Topic archived. No new replies allowed.