Mail Archives: djgpp/1998/08/26/12:55:17
> Hi,
>
> I use gcc version 2.7.2.1 and I try to reserve some memory with "new".
> My problem is, if there is not enough memory the program returns to
> the OS (code 255), what I don't want.
> How can I avoid this?
>
> tia...
> ...Klaus...
>
>
new returns NULL if memory allocation fails. You should always test for this.
eg:
int *a;
a = new int;
if(!a){ do_something() }
I think this should work.
James Arthur
jaa AT arfa DOT clara DOT net
ICQ#15054819
- Raw text -