📄 fi
字号:
@c ----------------------------------------------------------------------
@node _filbuf, stdio
@heading @code{_filbuf}
@subheading Description
This is an internal function used to implement stream buffering.
@c ----------------------------------------------------------------------
@node fileno, stdio
@heading @code{fileno}
@subheading Syntax
@example
#include <stdio.h>
int fileno(FILE *file);
@end example
@subheading Description
This function returns the raw file descriptor number that @var{file}
uses for I/O.
@subheading Return Value
The file descriptor number.
@c ----------------------------------------------------------------------
@node _findenv, environment
@heading @code{_findenv}
@subheading Description
This is an internal function used by @code{getenv} and @code{setenv}.
@xref{getenv} @xref{setenv}
@c ----------------------------------------------------------------------
@node findfirst, file system
@heading @code{findfirst}
@subheading Syntax
@example
#include <dir.h>
int findfirst(const char *pathname, struct ffblk *ffblk, int attrib);
@end example
@subheading Description
This function and the related @code{findnext} are used to scan
directories for the list of files therein. The @var{pathname} is a
wildcard that specifies the directory and files to search for (such as
@code{subdir/*.c}), @var{ffblk} is a structure to hold the results and
state of the search, and @var{attrib} is a combination of the following:
@table @code
@item FA_RDONLY
Include read-only files in the search
@item FA_HIDDEN
Include hidden files in the search
@item FA_SYSTEM
Include system files in the search
@item FA_LABEL
Include the volume label in the search
@item FA_DIREC
Include subdirectories in the search
@item FA_ARCH
Include modified files in the search
@end table
Any file that doesn't have any flag bits that aren't specified is
selected for the search. Thus, if you specified @code{FA_DIREC} and
@code{FA_LABEL}, you would get all subdirectories, the volume label, and
any file that is neither read-only or modified.
The results of the search are stored in @var{ffblk}:
@example
struct ffblk @{
char ff_reserved[21]; /* used to hold the state of the search */
char ff_attrib; /* actual attributes of the file found */
short ff_ftime; /* hours:5, minutes:6, (seconds/2):5 */
short ff_fdate; /* (year-1980):7, month:4, day:5 */
short ff_filler; /* gcc aligns "long" different than DOS */
long ff_fsize; /* size of file */
char ff_name[16]; /* name of file as ASCIIZ string */
@}
@end example
@subheading Return Value
Zero if a match is found, nonzero if none found.
@subheading Example
@example
struct ffblk f;
int done = findfirst("*.exe", &f, FA_ARCH|FA_RDONLY);
while (!done)
@{
printf("%10u %2d:%02d:%02d %2d/%02d/%4d %s\n",
f.ff_fsize,
(f.ff_ftime >> 11) & 0x1f,
(f.ff_ftime >> 5) & 0x3f,
(f.ff_ftime & 0x1f) * 2,
(f.ff_fdate >> 5) & 0x0f,
(f.ff_fdate & 0x1f),
((f.ff_fdate >> 9) & 0x7f) + 1980,
f.ff_name);
done = findnext(&f);
@}
@end example
@c ----------------------------------------------------------------------
@node _findiop, stdio
@heading @code{_findiop}
@subheading Description
This is an internal function used by @code{fopen}. @xref{fopen}
@c ----------------------------------------------------------------------
@node findnext, file system
@heading @code{findnext}
@subheading Syntax
@example
#include <dir.h>
int findnext(struct ffblk *ffblk);
@end example
@subheading Description
This finds the next file in the search started by @code{findfirst}. @xref{findfirst}
@subheading Return Value
Zero if there was a match, else nonzero.
@c ----------------------------------------------------------------------
@node _fixpath, file system
@heading @code{_fixpath}
@subheading Syntax
@example
void _fixpath(const char *in_path, char *out_path);
@end example
@subheading Description
This function canonacalizes the input path @var{in_path} and stores the
result in the buffer pointed to by @var{out_path}.
The path is fixed by removing consecutive and trailing slashes, making
the path absolute if it's relative, removing "." components, collapsing
".." components, adding a drive specifier if needed, and converting all
slashes to '/'.
@subheading Return Value
None.
@subheading Example
@example
char oldpath[100], newpath[100];
scanf(oldpath);
_fixpath(oldpath, newpath);
printf("that really is %s\n", newpath);
@end example
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -