Hi,
I have a command line cpp program that works both with manual input and '<' from stdin. And now it behaves differently. with keyboard input it stops at cin.getline, like below and awates for [input] +ENTER.
If I start program with < input.txt, then it just flow thru this line without any stops and eventually caused the loop.
How I can make it stop, or what system arg,var, register, etc.. is holding info about that difference, so I can handle this.
I play with cin.ignore, no help.
Tx all
M
eg.
1 2 3 4
....
cin.getline(WinBuffer, BufferSize); //*doesn't stop with $_prog1.exe < inp.txt
....
Thanks, Peter !
It's clear, is it possible to supply endl explicitly with WinBuffer if it doesn't have it.
Not sure newline = endl or not? Or I can use something different than getline like get()?
Something like below, sorry for my syntax, I'm still in learning mode.
Or there is other way to reset getline() after first use, I tried to clean winbuffer but it also didn't help.
1 2 3 4
If Winbuffer 'holds' endl
continueelse
append winbuffer=winbuffer + endl;