I have two strings one was retrieved from an input file using getline(name) and the other is at a position in an array of structs, Struct[n].type.
I have output both strings (the struct at n = 0) to see if they are identical and indeed they are but if I try to use an if statement to compare them:
if(name == Struct[0].type) it doesn't return true. Is there another way I should be comparing them because that's the only thing I can think of. They are exactly identical. Thanks for the help.
If you are using the std::string == operator, then the two strings are not identical. Check the sizes of them too, it could be that one or the other has some characters that aren't printed or are printed in a hard to see way (like '\0' or maybe '\n')
firedraco, I have checked for that and there are no additional spaces or extra characters. yes, name is the string name that I used in getline(); I've tried compare as well : if (name.compare(Stuct[n].type) == 0)