📄 fs
字号:
@c ----------------------------------------------------------------------
@node fscanf, stdio
@heading @code{fscanf}
@subheading Syntax
@example
#include <stdio.h>
int fscanf(FILE *file, const char *format, @dots{});
@end example
@subheading Description
This function scans formatted text from @var{file} and stores it in the
variables pointed to by the arguments. @xref{scanf}
@subheading Return Value
The number of items successfully scanned.
@c ----------------------------------------------------------------------
@node fseek, stdio
@heading @code{fseek}
@subheading Syntax
@example
#include <stdio.h>
int fseek(FILE *file, long offset, int mode);
@end example
@subheading Description
This function moves the file pointer for @var{file} according to
@var{mode}:
@table @code
@item SEEK_SET
The file pointer is moved to the offset specified.
@item SEEK_CUR
The file pointer is moved relative to its current position.
@item SEEK_END
The file pointer is moved to a position @var{offset} bytes from the end
of the file. The offset is usually nonpositive in this case.
@end table
@emph{Warning!} The ANSI standard only allows values of zero for
@var{offset} when @var{whence} is not @code{SEEK_SET} and the file has
been opened as a text file. Although this restriction is not enforced,
beware that there is not a one-to-one correspondence between file
characters and text characters under MS-DOS, so some @code{fseek}
operations may not do exactly what you expect.
@subheading Return Value
Zero if successful, nonzero if not.
@subheading Example
@example
fseek(stdin, 12, SEEK_CUR); /* skip 12 bytes */
@end example
@c ----------------------------------------------------------------------
@node fsetpos, stdio
@heading @code{fsetpos}
@subheading Syntax
@example
#include <stdio.h>
int fsetpos(FILE *file, const fpos_t *offset);
@end example
@subheading Description
This function moves the file pointer for @var{file} to position
@var{offset}, as recorded by @code{fgetpos}.
@xref{fgetpos}.
@xref{fseek}.
@subheading Return Value
Zero if successful, nonzero if not.
@c ----------------------------------------------------------------------
@node fstat, stdio
@heading @code{fstat}
@subheading Syntax
@example
#include <sys/stat.h>
int fstat(int file, struct stat *sbuf);
@end example
@subheading Description
This function obtains the status of the open file @var{file} and stores
it in @var{sbuf}. @xref{stat}
@subheading Return Value
Zero on success, nonzero on failure.
@c ----------------------------------------------------------------------
@node fsync, stdio
@heading @code{fsync}
@subheading Syntax
@example
#include <osfcn.h>
int fsync(int file);
@end example
@subheading Description
Forces all information about the file to be synchronized with the disk
image.
@subheading Return Value
Zero on success, nonzero on failure.
@subheading Example
@example
fsync(fileno(stdout));
@end example
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -