This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: is there any way for exit(1)


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
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]