I have checked several such questions on SO like : Link 1 and Link 2
But none of their answers is helping me. After spending so many hours in debugging, I am unable to detect the bug. So, I am asking it here, again.
The code for my program is :
#include<iostream>
#include<fstream>
#include<string.h>
using namespace std;
int main(){
ofstream file;
file.open("data.dat",fstream::out);
file<<fflush;
if(!file)
cout<<"error"<<strerror(errorno);
file.close();
return 0;
}
This is the main stem of the program dealing with file handling. The remaining portion of the program deals with processing some data and writing it to the file which, I think, is neither relevant nor affecting the file handling.
The interesting thing is the program is not flashing any error.