Friday, September 21, 2007

stricmp() in Linux

OK. This is a short one. I would say I'm still pretty new to be a real fulltime Linux developer, so this is the first time I met this problem.

I've been using stricmp() for a long long time but this is the first time I found there's no stricmp() in Linux. Instead, Linux has a similar function called strcasecmp() (also a corresponding strncasecmp() ). Besides that, these two functions are not defined in string.h, instead, they reside in a separate header file called strings.h. That's it.

This is really annoying especially when you are considering portability.

9 comments:

Anonymous said...

Helped me thou hast.

Anonymous said...

Thanks, that helps!

CrossFire said...

Thanks!

leonardo.pignataro said...

thanks a lot!!, I was looking forward this info!!

Anonymous said...

Man, talk about crappy comments.

Look, what do you suggest then?

I cannot believe the comments you have here are from people with the reading comprehension to actually read what you wrote.

For me, I will probably simply typedef the name for windows code.

Anonymous said...

It's even more fun because stricmp is deprecated in favor of _stricmp (at least in MSVC).

Thanks for the tip!

fuma said...

Thanks a lot this Post was very helpful! I was trying to compile my Program in Linux (worked fine in Windows + Cygwin) and was getting mad with these "out of scope" errors ;)

Pix3l said...

Simple and concise! You've been a great help :D

Anonymous said...

it is still in string.h