📄 du
字号:
@c ----------------------------------------------------------------------
@node dup, io
@heading @code{dup}
@subheading Syntax
@example
#include <osfcn.h>
int dup(int old_handle);
@end example
@subheading Description
This function duplicates the given file handle. Both handles refer to
the same file and file pointer.
@subheading Return Value
The new file handle, or -1 if error.
@subheading Example
@example
do_file(dup(fileno(stdin)));
@end example
@c ----------------------------------------------------------------------
@node dup2, io
@heading @code{dup2}
@subheading Syntax
@example
#include <osfcn.h>
int dup2(int existing_handle, int new_handle);
@end example
@subheading Description
This call causes @var{new_handle} to refer to the same file and file
pointer as @var{existing_handle}. If @var{new_handle} is an open file,
it is closed.
@subheading Return Value
The new handle, or -1 on error.
@subheading Example
@example
/* copy new file to stdin stream */
close(0);
dup2(new_stdin, 0);
close(new_stdin);
@end example
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -