如何使用try,catch.

解决方案 »

  1.   

    try
    {
        // Do something to throw an exception.
    }
    catch(CException* e)
    {
        if (m_bPassExceptionsUp)
            throw;    if (m_bThrowDifferentException)
        {
            e->Delete();
            throw new CMyOtherException;
        }    if (m_bReturnFromThisFunction)
        {
            e->Delete();
            return;
        }    e->Delete();
    }
      

  2.   

    如果不明确具体错误类型的话,可用以下方式
    try
    {   
      //代码
       
    }
    catch (...)
    {
      //提示
    }