mv2devnull
Golden Member
- Apr 13, 2010
- 1,511
- 149
- 106
Dirty little variant from iCyborg's:
Code:
// destructor does no close MyFile, so resort to macro
#define BREAKOUT { fp.close(); return ret; }
bool function(int ID)
{
MyFile fp;
bool ret = false;
fp.open("filename");
int index = fp.findIndex(ID);
if (index == IndexNotFound) BREAKOUT
int x = fp.readX(index);
if (x<0 || x>100) BREAKOUT
int y = fp.readY(index);
if (y == 0) BREAKOUT
fp.writeDiv(x/y);
ret = true;
BREAKOUT
}