catch und try funktioniert nich richtig
-
hio!
also folgender code:int problem = 5; try { if (problem > 3) { throw "Fehler"; } } catch (char *err) { cout << "Ausnahme aufgetreten: " << err << endl; }problem ist nun das er der fehler dann nicht angezeigt wird, sondern dieser standardtext hier kommt:
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.wenn ich es zb mit
throw 5;und
catch (int errno) { cout << errno << endl; }mache, funktionierts..woran kann des liegen?
nutze dev-c++
-
Du wirfst einen const char*, fängst aber einen char*, was nicht geht, da man zwar einen char* in einen const char* umwandeln kann, aber nicht andersrum.
-
Versuche mal const char*

-
ahh danke euch

mache das ganze gerade mit dem buch "c++ für spieleprogrammierer" da stand so drin...naja egal
-
Wer wirft denn auch bitte primitive Datentypen? *kopfschüttel*