Date: Wed, 10 Mar 93 23:21:47 +0100 From: Gordon Beaton To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: STRCMP (problem?) > > Isn't strcmp supposed to return numbers <0,=0,>0 as results? > It does, at least for me. (gcc 2.2.2) Are you really sure those are the values you're getting? This is what I get: strcmp("number","number") = 0 strcmp("number","number#") = -35 strcmp("is","what") = -14 strcmp("was","that") = 3 The return value seems to be the ascii value difference at the first character mismatch -- 'i'-'w' = -14, 'w'-'t' = 3, etc. Have you checked that you're not doing something with another variable that could corrupt stat? (like exceeding array bounds or assigning a float value to an int...) /gordon ----------------------------------------------------------------------------- Gordon Beaton tel. 018-507405 gordon AT Minsk DOT DoCS DOT UU DOT SE +46-18-507405