In most of my code, the in.peek()
works as getting whatever the next char is supposed to be. However, when it is reading some symbols, it returns a number rather than the char, and I am not sure how to fix it to get the symbol I want.
The text file reads:
print "Good morning!!";
but during the " char I use file.peek()
to read the next symbol is a ;
to change the state of my switch, but it comes out as a number instead of the symbol.
This is how I am trying to print, I even created a temp char
and set it to in.peek()
, but that just comes out as a blank space.
char temp = in.peek();
cout<<"hit " << ch << " "<< in.peek()<<" "<<temp << endl;
The output is: "hit " 10 "
With the last bit being a blank space. Does anyone know how I can fix this so I get the ;
?