[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Function fncmp - compare filenames w/wildcards
Syntax int fncmp(char *fname1, char *fname2);
Prototype in filehk.h
Remarks compares filename fname1 to fname2 with wildcard
matching (*,?). Case is irrelevant.
Return value return a value
< 0 if fname1 is less than fname2
= 0 if fname1 is the same as fname2
> 0 if fname1 is greater than fname2
In fact, if the value returned is 1 or -1, the
compare failed during the filename portion, and if
2 or -2 is returned, the compare failed during the
extension portion.
Note fncmp() compares strings just like DOS does (or at
least DOS 3.2, the one I work under.) Thus:
"STR*.*" = "str*.*"
"str.d*" = "StR.DZ"
"str" = "str.c"
Very little error checking is done. If an invalid
filename is passed (i.e. more than 12 characters
long) unpredictable results may occur.
See also fname_match()
Example #include <filehk.h>
main()
{
char a[12], b[12];
int cmp;
strcpy(a,"stringhk.c");
strcpy(b,"?TRI*.cc");
printf("%s ",a);
cmp = fncmp(a,b);
printf("Compare: %s %s Yields: %d\n",
a,b,cmp);
}
Program output Compare: stringhk.c ?TRI*.cc Yields: -2
See Also:
fname_match()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson