hello i am trying to compile my program but the compiler does not accept strcmpi()
what is another function i can use???
hello i am trying to compile my program but the compiler does not accept strcmpi()
what is another function i can use???
Perhaps, you have a typo. TryAlthough, there is a safer functionCode:strcmp()Code:strncmp()
I like to play pocket pool.
strcmpi() is a case-insensitive version of strcmp(). If your compiler's library doesn't have strcmpi(), then you'll either have to write your own, or settle for a case-sensitive string comparison. The macros/functions in <ctype.h> such as tolower(3) should be useful in writing a portable strcmpi() implementation.
Insert obnoxious but pithy remark here
Some compilers have stricmp() instead. But the best idea is to write your own version.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
so how do i write my own version to it?
There's also strcasecmp
Well, a good start would be to iterate through each string, comparing each character one at a time, but instead of just comparing them for equality, pass each character through either toupper or tolower, to make it case insensitive.
And _stricmp(), for MSVC.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.