|
-
November 10th, 2006, 06:40 AM
#1
Exception Handling
Hi,
I'm having many problems working with exception, which I'm not used to.
First of all, does anybody know a good tutorial, manual, whatever,.... about'em? It'd be wondelfull if it was in Spanish , but in English will be enough too.
I've made a very simple program to catch and exception, and I don't know why it's not cached:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
char *a = NULL;
try{
printf("Reservem\n");
a = new char[20];
printf("Incialitzem\n");
memset(a, 0x00, 2000);
printf("Accedim a 200\n");
a[200] = '2';
printf("Borrem\n");
delete []a;
printf("Sortim\n");
}
catch(...){
printf("Exception captured\n");
delete []a;
exit(EXIT_FAILURE);
}
return 0;
}
It's compiled with GNU GCC:
g++ -Wall -fexceptions -o prova.exe prova.cpp
I don't know why I can't catch the exception (I think I should)?
Thanks a lot, and sorry for my english.
Albert.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|