Visual Basic's On Error Resume Next for c++?

c++, vb6, vba, visual-c++

Solution

This would be the equivalent of the VB code:

   for (i = 1;  i <= 100; i++)
       {
           try {               
               // Read OPC tags code here
           catch(…)
           {

           }
       }
   }

but you may want to wrap another try catch block round the whole lot as well.

Problem

Is there an equivalent to Visual Basic‘s On Error Resume Next for C++ where by if an error occurs code continues to execute without prompting user? Ideally, would like to catch any exceptions and log them to log.txt file and examined later instead of having exceptions abruptly exiting code. Visual Basic: ``` For i = 1 to 100 On Error Resume Next ReturnedOpcVal[i] = OPC.ReadTag(“Server.Path.Tag” & "TagName_" & Cstr(i)) Next i ``` C++, I’m thinking this: ``` Try { // Try looping through code here For (i = 1; i <= 100; i++) { // Read OPC tags code here } } Catch(…) { // log error to file code } ```

Original source