i have a program with 2 cases.
argc=1
= interactive modeargc=3
= input output file
if(argc == 1){
bool finish= false;
while (!finish){
try{
std::cout<<"Gcalc>";
std::string line;
std::getline(std::cin,line);
if(line==""){
finish= true;
continue;
}
and
if(argc == 3){
std::ifstream input_file(argv[1]);
std::vector<std::string> lines;
std::string line;
while (!(input_file.eof())&&std::getline(input_file, line))
{
lines.push_back(line);
}
input_file.close();
std::ofstream out(argv[2]);
/*if(!out.is_open()){
throw CouldNotOpenFile();
}*/
std::streambuf *coutbuf = std::cout.rdbuf(); //save old buf
std::cout.rdbuf(out.rdbuf());
bool finish= false;
std::cout.rdbuf(coutbuf);
out.close();
All of the logic behind my project works fine, the only thing is that when I std::cout
the string above: Gcalc
it works only in the terminal but when I send it to an auto checker of my project (I'm a student) it recognizes as a fail that the words gcam
that needs to be after every command doesn't show up. Any suggstions pls ?
Just to make sure - the logic works fine, the cout
prints fine every single thing just not the gcalc
.