Calling all Exceptions Guru's
I'm new to exceptions and I find myself struggling a little. Can some tell me why this doesn't work?
FILE* hFile;
try
{
// Assume hFile has not been initialised on purpose to generate exception
//This should raised an exception and jump to the catch block.
fputs("123", hFile);
......
}
catch( ... )
{
Do_something();
}
As I understand it, catch( ...) should catch all exceptions but in this case it doesn't. Can anyone help?
Spencer
Re: Calling all Exceptions Guru's
Quote:
Originally posted by gingerspen
I'm new to exceptions and I find myself struggling a little. Can some tell me why this doesn't work?
The 'C' FILE* streams do not throw exceptions. Unless the underlying fputs() code does a divide by 0, an illegal kernel memory access, or something else that would trigger a system crash, an exception will never be thrown.
Regards,
Paul McKenzie
Re: Re: Calling all Exceptions Guru's
Quote:
Originally posted by Paul McKenzie
The 'C' FILE* streams do not throw exceptions. Unless the underlying fputs() code does a divide by 0, an illegal kernel memory access, or something else that would trigger a system crash, an exception will never be thrown.
Regards,
Paul McKenzie
Paul, thank you very much for your help.
Spencer