You could do something as in this piece of pseudo-code:Quote:
Originally Posted by BrownB
It's up to you whether or not you prefer it this way. Other languages like C#, Java or Delphi/Pascal offer exception handling for this situation. I'm not sure about C++, but I think it does, too.Code:err= open(database);
if (!err) {
err= read(database);
if (!err) {
err= dosomething(database);
if (!err)
err= write(database);
}
close(database);
}
if (err)
printf("error %i while %s\n", err, getdesc(err));