And are you sure that str is long enough to hold both the formatted integer and floating point number?
Maybe be safe and use QString::sprintf() instead?
Also this looks a lot like a C API, not a C++ API with exceptions.
Cheers,
_
And are you sure that str is long enough to hold both the formatted integer and floating point number?
Maybe be safe and use QString::sprintf() instead?
Also this looks a lot like a C API, not a C++ API with exceptions.
Cheers,
_
it does crash when invoking "fann_read_train_from_file". The point is that I have intentionaly made it crash, just to test if I can handle the exceptions. "fann_read_train_from_file" requires a well formated file and I selected a random binary file as input. With a proper file it works ok, but the point here is, to make my app able to handle the FANN library exceptions.On which line does it crash ? What is the stack trace ? Have you tried to verify that "TestData" and "ann" pointers are not null ?I'm not sure about that, I'm still learning C an QtAnd are you sure that str is long enough to hold both the formatted integer and floating point number?
Maybe be safe and use QString::sprintf() instead?
Also this looks a lot like a C API, not a C++ API with exceptions.I think it is a C API http://leenissen.dk/fann/wp/download/, but if its not, can I still handle excpetions when invoking it's functions? Sorry if this looks an elementry issue, but I am a newbie..
A C library does not use exceptions, that is a C++ concept, i.e. there is nothing to catch if this library is written in C.
My guess is that what you are seeing and what lead to this misunderstanding is a "runtime exception" on Windows, i.e. a segmentation fault on Unix.
You'll need to find the cause and fix it at the point where it happens or make sure that the execution path does not reach that location and state.
Cheers,
_
Ok, I got it now, thanks for making that clear.A C library does not use exceptions, that is a C++ concept, i.e. there is nothing to catch if this library is written in C.
Bookmarks