I need to compare user input to an array and find the index. I want to use toupper bot having some trouble with the reference to array.
This is the current line:
if (allCities[index].city == input)
I want to do this:
if (toupper(allCities[index].city) == toupper(input))
or
if (allCities[index].toupper(city) == toupper(input))
I get an error on the first parameter becuase it is an int. Have even tried converting to index just before the compare in the above line, but still thinks I am comparing int with string.
The problem with that approach is that it has to modify both strings, so it can't be used with const strings.
I have to admit that in this kind of situation I use _stricmp/stricmp (VC++, MinGW) or strcasecomp. Wrapped up so the evil, platform-specific code is hidden away...