D
D
DiIce2016-01-31 14:21:09
C++ / C#
DiIce, 2016-01-31 14:21:09

How to make a destructor without OOP?

There is a console application in C ++, purely "functional style"
Sometimes it kicks it out with an error, it just kicks it out and that's it.
And how to make it so that before this knocking out the program has time to do a couple of actions - for example, send a request to the database?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Peter, 2016-01-31
@petermzg

You can convert system and hardware exceptions to C++ (windows) exceptions.
_set_se_translator + project /EHa

A
AtomKrieg, 2016-01-31
@AtomKrieg

int main(int argc, char* argv[])
{
  try {
    //все что было в main
  } catch (exc) {
    // отправить запрос на базу;
    // выйти с ошибкой;
    return 1;
  }
  return 0;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question