I'm trying to do operations per-line of a text file, and the way I have it right now, my ifstream
object isn't detecting the \n
character for each line, which is required for this project. Here's how I have it right now:
std::ifstream instream;
instream >> value;
while (value != '\n')
{
// do code and such
}
But when I have it run the loop, all I'm getting is a single line of everything in the program. While it is doing exactly what it is supposed to in the loop, I NEED the \n
to be recognized. Here's my .txt
file:
LXXXVII
cCxiX
MCCCLIV
CXXXLL
MMDCLXXIII
DXLCC
MCdLxxvI
XZ
X
IV
Exactly like that. I cannot change it.
value
? You might want to usevalue = cin.get()
instead ofcin >> value
. – Sniffygetline
. – Azaria