My code is something like this. The problem is it only execute csis and not the cout ! if I switch order then only cout and not csis. I am new to c++, so is there something about ofstream I am missing ? or there's something strange in my function called ?