C++ file handling
Reading whole file.
[sourcecode language=”cpp”]
try
{
stringstream script;
ifstream scriptFile( “ex.txt”, ios::in ); scriptFile.exceptions(ifstream::failbit | ifstream::badbit); //This has to be if ios_base::failure has to be thrown script « scriptFile.rdbuf(); if ( script.rdstate != 0) throw; }
catch(ios_base::failure fe)
{
}
//converting hex integer to string representation stringstream convert; convert « hex « line; [/sourcecode]