I'm running my code and give inputs via a .txt file(./a.out<input.txt
), but it seems it does not recognize end of file.
when I copy the contents in ubuntu it works. I think that files were created in MAC.
EOF is like CTRL+C in terminal so it should stop executing the code but the last command continuously is parsing as input. I can not change the file (It is test file and the format is unchangeable.). Can anyone please help me with this problem? I have attached my code, but I think that is the file problem.
EDIT: I found the solution. By adding
if(!getline(cin, s)){
break;
}
or similar lines, the problem will be fixed!