I met the strncmp function in my work. When I switched from C to Java, I did not know its return value range. As a result, an error occurs, and the outsourcer cannot record the order, the problem is serious. Below is a pieceCode:
If (strcmp (sctctcde, "014012") = 0 ){
If (strcmp (sbsnstyp, "19001") = 0) | (strcmp (sbsnstyp, "19007") = 0 )){
Sprintf (stmp, "This Department attribute is exclusive4s storesThe business source can only be an agency proxy! ");
Return (setusererror (lpinbuffer, 2, stmp ));
}Else if (strncmp (sprodno, "03", 2) {// if equal, return 0 instead of true.
Sprintf (stmp, "this department is an exclusive 4s store and can only provide auto insurance services! ");
Return (setusererror (lpinbuffer, 2, stmp ));
}
}
Strncmp () function usage
The function is used to compare the first n characters (case sensitive) of a string ).
This function returns the following values:
0-if the string is equal
<0-If string1 is smaller than string2
> 0-If string1 is greater than string2
Syntax: strncmp (string1, string2, length)