Not sure if i should have added this to my enum post but oh well. If i have a file and read the in a line such as:

CPTR212 Programming 1

then it searches the string for "Programming" if finds it and than how can i get to go back to the beging of that specific line. The file i am using has a bunch of different lines all at diff lengths.

sample file:

CPTR211 Web Design
CPTR212 Programming 1
CPTR213 Database Management
MATH101 College Algebra
MUS207 Keynotes
ART101 Basic Drawing

I am tring to write a function to let the user either enter the course ID or the actual course name. CPTR211 for example would be the course ID and Web Design would be the actual Course Name. Here is some code i have. I cant get it to work correctly. I know this right always enters the same if statment but i cant figure out a way to switch it around. I need to store the ID and course name. If id is entered than it stores it and get the course name automatically. Vice versa, if the course name is entered it get stored than it get the id for that class automatically. Please Help. This is kinda urgent but not too much.

Code:
string students::getCourse()
{
	char Classname[256],
		ch;
	string ClassName,
		Class,
		str;
	bool loop = true;
	ifstream inStream;
	int pos,
		i = 0;

	cout << "Course: ";
	cin.getline(Classname, 256, '\n');
	ClassName = Classname;
	str = ClassName.substr(0, 4);

	inStream.open("classID.kss");
	if (inStream.is_open())
	{
		while (loop)
		{
			inStream >> Class;
	
			pos = ClassName.find(Class.data(), 0);
			if (pos != string::npos)
			{
					if (Class.substr(0, 4) == str)
					{
						CourseID = Class;
						inStream.get(ch);
						getline(inStream, Class);
						CourseName = Class;
						cout << endl << "Yes\nCourse ID: " << CourseID << endl << "Course Name: " << CourseName << endl;
						break;
					}
					else
					{
						CourseName = Class;			
						getline(inStream, Class);
						CourseName = CourseName + Class;
						inStream >> Class;
						CourseID = Class;
						cout << endl << "Course ID: " << CourseID << endl << "Course Name: " << CourseName << endl;
						break;
					}
				break;
			}

			if (inStream.eof())
			{
				break;
			}

		}//End Infinite For Loop
	}

	return CourseName;
}//End getClassName Function