I am trying to change the position stream pointer for input to the beginning of a file using
but after printing out encodedfile.tellg() afterwards, the pointer stays at -1 and I can't read any of the text inside the file.
Here is the declaration of the variable
and this is where text is outputted to the file
std::fstream encodedfile(encodedfilename,std::fstream::in | std::fstream::out);
Is there another way to return the stream pointer to the beginning or is there a way to fix my code?
while(file >> std::noskipws >> ch)
encodedfile << hasbinary[(unsigned int)ch].binaryencoding;
cout << hasbinary[(unsigned int)ch].binaryencoding;