📄 fn
字号:
@c ----------------------------------------------------------------------
@node fnmatch, file system
@heading @code{fnmatch}
@subheading Syntax
@example
#include <fnmatch.h>
int fnmatch(const char *pattern, const char *string, int flags);
@end example
@subheading Description
This function indicates if @var{string} matches the @var{pattern}. The
pattern may include the following special characters:
@table @code
@item *
Matches zero of more characters.
@item ?
Matches exactly one character
@item [...]
Matches one character if it's in a range of characters. If the first
character is @code{!}, matches if the character is not in the range.
Between the brackets, the range is specified by listing the characters
that are in the range, or two characters separated by @code{-} to
indicate all characters in that range. For example, @code{[a-d]}
matches @code{a}, @code{b}, @code{c}, or @code{d}.
@item \
Causes the next character to not be treated as a wildcard. For example,
@code{\*} matches an asterisk. This is only available if @var{flags}
includes @code{FNM_QUOTE}.
@end table
The value of @var{flags} is a combination of zero of more of the
following:
@table @code
@item FNM_PATHNAME
This means that the string should be treated as a pathname, in that the
slash character @code{/} never matches any of the wildcards.
@item FNM_QUOTE
This means that the backslash @code{\\} may be used for quoting special
characters in the pattern.
@end table
@subheading Return Value
Zero if the string matches, FNM_NOMATCH if it does not.
@subheading Example
@example
if (fnmatch("*.[ch]", filename, FNM_PATH|FNM_QUOTE))
do_source_file(filename);
@end example
@c ----------------------------------------------------------------------
@node fnmerge, file system
@heading @code{fnmerge}
@subheading Syntax
@example
#include <dir.h>
void fnmerge (char *path, const char *drive, const char *dir,
const char *name, const char *ext);
@end example
@subheading Description
This function constructs a file @var{path} from its components.
@xref{fnsplit}
@subheading Return Value
None.
@subheading Example
@example
char buf[MAXPATH];
fnmerge(buf, "d:", "/foo/", "data", ".txt");
@end example
@c ----------------------------------------------------------------------
@node fnsplit, file system
@heading @code{fnsplit}
@subheading Syntax
@example
#include <dir.h>
int fnsplit (const char *path, char *drive, char *dir,
char *name, char *ext);
@end example
@subheading Description
This function decomposes a @var{path} into its components.
@xref{fnmerge}
@subheading Return Value
A flag that indicates which components were found:
@table @code
@item DRIVE
The drive letter was found.
@item DIRECTORY
A directory or subdirectories was found.
@item FILENAME
A filename was found.
@item EXTENSION
An extension was found.
@item WILDCARDS
The path included @code{*} or @code{?}.
@end table
@subheading Example
@example
char d[MAXDRIVE], p[MAXDIR], f[MAXFILE], e[MAXEXT];
int which = fnsplit("d:/djgpp/bin/gcc.exe", d, p, f, e);
d = "d:"
p = "/djgpp/bin/"
f = "gcc"
e = ".exe"
@end example
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -