is there any way for exit(1)

gfx art xgrafix@gmail.com
Tue Mar 24 23:26:00 GMT 2009


Thank you very much for your reply.. but I get the same error

List.cpp: In member function ‘void List::erase(int)’:
List.cpp:68: error: ‘exit’ was not declared in this scope

***********************

and this is my member function

#include <iostream>
#include <cassert>

using namespace std;

#include "List.h"

void List::erase(int pos)
{
	if (mySize == 0)
	{
		cerr << "*** List is empty ***\n";
		exit(1);	// I can't use it
	}

	if (pos < 0 || pos >= mySize)
	{
		cerr << "Illegal location to delete -- " << pos
		     << ".  List unchanged. ***\n";
		return;
	}

	// Shift array elements left to close the gap
	for(int i = pos; i < mySize; i++)
		myArray[i] = myArray[i + 1];

	// Decrease list size
	  mySize--;
}



Thank you very much for your time and I know how you help others in
open source world
Ali Mirza..



On Wed, Mar 25, 2009 at 12:49 AM, John (Eljay) Love-Jensen
<eljay@adobe.com> wrote:
> Hi gfx art,
>
> Try this...
>
> #include <cstdlib>
>
> if (mySize == CAPACITY)
> {
>   cerr << "No space" << endl;
>   std::exit(1)
> }
>
> HTH,
> --Eljay
>



More information about the Gcc-help mailing list