• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1084
  • Last Modified:

How to ignore errors (using Borland C++ Builder)

I've created an application which performs various tasks automatically (e.g copying a file, deleting a file etc). But sometimes, various errors can pop up (e.g trying to copy a file when used by another application , and generally any other possible error in the code) .
I would like my application to ignore any error comes in the way, and then restart its task all over again. Is this possible?

Thanks a lot.
0
Chrysaor
Asked:
Chrysaor
1 Solution
 
evilrixSenior Software Engineer (Avast)Commented:
Can you give a more concrete example? This is a little bit like asking how long is a piece of string. The action you take will be directly dependent upon what it is you are actually doing. Some example code wouldn't hurt none either.
0
 
BanjoviCommented:
You can check each operation you perform to see if it succeeds and take appropriate action if it does not:

if( !CopyFile( sSrcFile.c_str(), sDestFile.c_str(), false ) )
      {
          String sMsg = "CopyFile failed. See log file";
          ShowMessage( sMsg );
          return false;
      }
0
 
danaceCommented:
have you tried try..catch..statements? Maybe you are referring to the "On Error Resume" equivalent in VB. But I think there is none of that in BCB
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now