Does ifstream::get read whitespace? I think it can. Use .get() instead of using the >> operator. i.e. plainVector.push_back( cyphFile.get() );
twomers
Posting Virtuoso
1,877 posts since May 2007
Reputation Points: 453
Solved Threads: 57
Alright that worked. Though there was one problem. An y with . . over it was put at the end. Could you explain that?
EDIT: I also was wondering if I can merge all white space into one ' ' char as far as the vector is concerned.
I don't know what you mean here:An y with . . over it was put at the end.
Is that a Unicode character? A letter with two dots over it?
Regarding the merging of spaces, don't merge them. Simply don't push a space onto the vector if the last character pushed onto the vector was also a space. Throw the second, third, fourth spaces away and grab the next character from the input stream without pushing those spaces onto the vector:
char aChar = cyphFile.get ();
if (aChar == ' ')
{
// check if top element of vector is a space. If
// not, push the space onto the vector. If it is
// a space, do nothing.
}
else
// push aChar onto the vector.
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711