Exception-Behandlung
-
Hallo!
Kann mir einer ein Beispiel für eine Exception-Behandlung für C++ mit try/catch und throw schreiben und erklären.Danke !! oli
-
Hallo
try { float Wert = StrToFloat(Edit1->Text); Edit2->Text = FloatToStr(Wert * 2); } catch(...) { ShowMessage("Im Textfeld steht keine float-Zahl!"); }bis bald
akari
-
Hallo,
Aus einem C++ Tutorial
http://tutorial.schornboeck.net/exceptions.htm
-
Zugriff auf den Fehlermeldungstext hat man im BCB wie folgt:
try { ; //irgendwas... } catch (Exception &e) { Application->MessageBox(e.Message.c_str(), "Fehler...", MB_OK | MB_ICONERROR); }
-
aber nur, wenn es eine VCL-Exception ist.

Bei einer std::exception sieht das so austry { ; //irgendwas... } catch (std::exception &e) { Application->MessageBox(e.what(), "Fehler...", MB_OK | MB_ICONERROR); }