ok short and sweet hopefully. suppose you have a struct like so

struct SomeName
{
     string id;
}

and you read data from a file into the id then you want to search for a specific id that has a relationship to a name

long findStudent (StudentList list, long count, string student)
{
	long n;

	//loop for finding a student in list
	for(n=0;n<count;n++)
    {
		temp=list.students[n];
        if(temp.id==student)
            return n;
    }

	//return count
	return count;
}

i obviously didnt provide all code but can if needed. its a basic search function im just unsure how to search through the struct with the dot operator.

you mean this? if( list.students[n].id == student)

you mean this? if( list.students[n].id == student)

wow yes exactly. i should have known about the .id after students[n], but you helped me out big time. if we're keeping track thats twice now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.