Hi,
I am totally new to this programming stuff, and requesting u all ,to help me out in this .........

My Q is I have to take valid input FIle from the user ,and open it,until user presses -1 to exit........ or until he/she doesnt type the valid name (which in my case is "records.txt")......
My code is working ........but the problem is if I type valid name ,it get stucked.........

Code:
int main()
{


int number = 0;
string file = " ";
   ifstream inputFile("records.txt", ios::in );
   cout<<"Enter the file (-1 to end)"<<endl;
   file=readLine();

   while(file !="-1")
   {
		
		
	if(file != "records.txt" )
	{
	   cout<<"File doesnt exist"<<endl;
	   inputFile.clear();
                  cout<<"Please re-enter"<<endl;
	    file=readLine();
			
	}
		
	}
	if (file == "-1")
	{
		exit(0);
	}

	if (file== "records.txt")
	{
	
	     inputFile.open("records.txt".c_str(), ios::in);
	     adatabase(database,number);// populating the database//
	     displayMainMenu();
                     getMenuOption(database,number);


	}
	
	return 0;
}

string readLine()
{
    char buffer[SIZE];
	cin.getline(buffer, SIZE, '\n');
	return buffer;
}