View Poll Results: Exception handling is ....

Voters
1. You may not vote on this poll
  • ..pretty easy.

    0 0%
  • ..sometimes too complicated.

    0 0%
  • ..something what I spent hours in understanding.

    0 0%
  • ..ununderstandable.

    1 100.00%

Exception handling

This is a discussion on Exception handling within the C++ Programming forums, part of the General Programming Boards category; Hi there! I've got to make some error checking, but I got stuck at exception handling. The problem is the ...

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    105

    Exception handling

    Hi there!

    I've got to make some error checking, but I got stuck at exception handling.

    The problem is the following:
    I'd like to make this

    temp=StrToInt(Ansistring text)

    I figured out that it works kinda like this to perform exception handling:

    code:
    try
    {
    temp=StrToInt(txtBox1hossz->Text);
    }
    catch (const exception& e)
    {
    ShowMessage("Error in given data!");
    goto finish;
    }


    When I try to compile this code part, I get an error "Catch statement missing". What did I do wrong?

    Thanks
    Han

  2. #2
    Registered User
    Join Date
    Mar 2003
    Location
    UK
    Posts
    169
    If you're just catching a general exeption and not throwing in your code, then just use 3 dots within the catch
    Code:
    catch (...)
    Last edited by Scarlet7; 04-06-2003 at 06:59 AM.

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    105
    Thanks!

    It seems to be working in my code.

    Han

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. signal handling and exception handling
    By lehe in forum C++ Programming
    Replies: 2
    Last Post: 06-15-2009, 10:01 PM
  2. Exception handling in a large project
    By EVOEx in forum C++ Programming
    Replies: 7
    Last Post: 01-25-2009, 06:33 AM
  3. exception handling
    By coletek in forum C++ Programming
    Replies: 2
    Last Post: 01-12-2009, 04:28 PM
  4. is such exception handling approach good?
    By George2 in forum C++ Programming
    Replies: 8
    Last Post: 12-27-2007, 07:54 AM
  5. Signal and exception handling
    By nts in forum C++ Programming
    Replies: 23
    Last Post: 11-15-2007, 01:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21