ok i think i have a problem with my loop in a function. i am reading a file to it and i need it to check to see if the buffer is equal to the user input, and if not go to the next line and do the sane again and print out when the result is found

i think the problem is in the loop as its not working properly but not sure, can someone please help

Code:
// Cfunctions.cpp: implementation of the functions class.
//
//////////////////////////////////////////////////////////////////////

#include "functions.h"
#include <iostream>
#include <windows.h>
#include <fstream.h>
#include <conio.h>
#include <stdlib.h>

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

Cfunctions::Cfunctions()
{

}

Cfunctions::~Cfunctions()
{

}

Cfunctions::Printall()
{
	system("cls"); //try to find an alternative in the faq

	ifstream file;
	file.open("flight.txt",ios::nocreate);

	if(!file)
		return -1;
	
	while(file && !file.eof()) 
	{ 
                file.get(ch); 

		switch(ch)
		{
			case '~': 
			case '%': 
			case '#':
				ch = 0;
				break; //really kind of unecessary
		}
	        cout << ch << flush;
	}			 

	file.close(); 
	getch(); 

	return 0;
}

int Cfunctions::Flightdetails()
{
	char temp[5];

	cout << "Please enter flight number" << endl;
	cin >> temp;
	system("cls");

	ifstream is("flight.txt",ios::nocreate);
	if(!is)
		return -1;

	
	char buffer[48];
	char buffer2[48];

	do 
	{
		is.getline(buffer,48, '#');
		if (buffer[0] == temp[0])
		{
			if (buffer[1] == temp[1])
			{
				if (buffer[2] == temp[2])
				{
					if (buffer[3] == temp[3])
					{
						if (buffer[4] == temp[4])
						{
							if (buffer[5] == temp[5])
							{
								cout << temp[0] << endl;
								cout << temp[1] << endl;
								cout << temp[2] << endl;
								cout << temp[3] << endl;
								cout << temp[4] << endl;
								cout << temp[5] << endl;
								cout << buffer << endl;
							}
						}
					}
				}
			}
		}
		else 
		{
			if (n == 0)
			{
				is.seekg(45, ios::beg);
				n++;
				cout << n << endl;
			}
			else
			{
				is.seekg(45, ios::cur);
			}
		}
		
	}while(is && !is.eof());	

	is.close();

    return 0;
}