sujan.dasmahapa 0 Light Poster

I apologize for the inconvenience this not a Qt question. I am using a library in my Qt application which is built and generated by lex and yacc compiler. When I am calling first time the function it’s working fine, a good file. Next time running a bad file from within the same application for which it throws an error, from within the same application, now if I call next time for the good file also it throws the error. The problem is the error. If an error occurs then next time onwards it throws error for even for a good file. How can I clear the error stream so that it runs good for the good file. Any help is highly appreciated. Thanks Sujan

bool upgrade_model(char *model, string &newModel); //this function is exposed by the static library.

string newmodel;
bool upgraded = upgrade_model("/home/red/good.model",&newmodel); // it runs fine
upgraded = upgrade_model("/home/red/bad.model",&newmodel); //it throws error
upgraded = upgrade_model("/home/red/good.model",&newmodel); //it throws error

How can I clear the error stream in the begining when a call is made to the function upgrade_model()