<< Previous | Next >> | |
|
NEAR SYNTAX: int _n_strncmp( char * str1, char * str2, n );
FAR SYNTAX: int _f_strncmp( char far * str1, char far * str2, unsigned n );
NOTE By default, strncmp()
is defined to_n_strncmp()
.Description
- Performs unsigned character by character comparison of two strings of length
n
.
- For Rabbit 4000+ users, this function supports FAR pointers. By default the near version of the function is called. The macro
USE_FAR_STRING
will change all calls to functions in this library to their far versions. The user may also explicitly call the far version with_f_strfunc
wherestrfunc
is the name of the string function.
- Because FAR addresses are larger, the far versions of this function will run slightly slower than the near version. To explicitly call the near version when the
USE_FAR_STRING
macro is defined and all pointers are near pointers, append_n_
to the function name, e.g.,_n_strfunc
. For more information about FAR pointers, see the Dynamic C User's Manual or the samples inSamples/Rabbit4000/FAR/
.Parameters
- str1
- Pointer to string 1.
- str2
- Pointer to string 2.
- n
- Maximum number of bytes to compare. If zero, both strings are considered equal.
Return value
<0
:str1
is less thanstr2
because
char instr1
is less than corresponding char instr2
.
=0
:str1
is identical tostr2
>0
:str1
is greater thanstr2
because
char instr1
is greater than corresponding char instr2
.Library
- STRING.LIB
See also
- strcmp, strcmpi, strncmpi
Dynamic C Functions | << Previous | Next >> | rabbit.com |