[comp.sys.mac.programmer] troubles with strncmp

jmv@sppy00.UUCP (J. Vickroy +1 614 764 4343) (01/15/91)

Please forgive me if this subject has been kicked around already. I must
not have caught it the first time.

I'm having trouble using strncmp(). This situation is that I'm reading
one string from a file (s1) and getting the other (s2) from my "STR#"
resource. After converting s2 with PtoCstr() I throw them into strncmp()
and it returns not equal for the strings that I *know* are equal. To
check I placed a NULL into s1 at the a particular offset and compare for
that length and they come out equal. My only guess is that the function
is comparing the NULL on the shorter string. BTW, the compare length is
gotten by a strlen() of the shorter string, which shouldn't include
the NULL byte. I don't read 68000 Assembler yet so I can't verify the
source to strncmp() which is written in in-line assembler.

Has anyone else experienced this problem? Anyone have any solutions?

Thanks in advance....

jim
--
Jim Vickroy                               | Voice:      +1 614 764 4343
Development Technologies Engineering      | Internet:   jmv@rsch.oclc.org
Online Computer Library Center, Inc.      | uucp:       osu-cis!sppy00!jmv
6565 Frantz Road, Dublin Ohio, 43017-0702 |