int errorCount=0;
ifstream welcomeFin("Welcome.txt");
if(!welcomeFin.good())// good() return true if I/O is ok.
{
errorCount++;
ofstream errorPlease ("ErrorDictionary.txt");
errorPlease<<"Error No: "<<errorCount<<endl;
if(welcomeFin.eofbit())
errorPlease<<"0x0001: Ops! EOF has reached.";
elseif(welcomeFin.badbit())
errorPlease<<"0x0002: Ops! I/O operation has failed.";
elseif(welcomeFin.goodbit())
errorPlease<<"0x0003: Ops! Logical error occured.";
errorPlease<<endl;
errorPlease.close();//closing stream
}
D:\Projects\Code Blocks\SetFunctions\main.cpp||In function 'int main()':|
D:\Projects\Code Blocks\SetFunctions\main.cpp|38|error: 'std::ios_base::eofbit' cannot be used as a function|
D:\Projects\Code Blocks\SetFunctions\main.cpp|40|error: 'std::ios_base::badbit' cannot be used as a function|
D:\Projects\Code Blocks\SetFunctions\main.cpp|42|error: 'std::ios_base::goodbit' cannot be used as a function|
||=== Build finished: 3 errors, 0 warnings (0 minutes, 1 seconds) ===|
Furthermore, i have already texts files. Welcome.txt and ErrorDictionary.txt in my program directory with .cpp file.