⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 op

📁 Algorithms for Image Processing and Computer Vision Source Code
💻
字号:
@c ----------------------------------------------------------------------
@node open, io
@heading @code{open}
@subheading Syntax

@example
#include <fcntl.h>    /* for O_* */
#include <sys/stat.h> /* for S_* */
#include <osfcn.h>

int open(const char *file, int mode, int permissions);
@end example

@subheading Description

This function opens the named @var{file} in the given @var{mode}, which
is any combination of the following:

@table @code

@item O_RDONLY

The file is opened for reading.

@item O_WRONLY

The file is opened for writing.

@item O_RDWR

The file is opened for both reading and writing.

@item O_CREAT

If the file does not exist, it is created. @xref{creat}

@item O_TRUNC

If the file does exist, it is truncated to zero bytes.

@item O_EXCL

If the file exists, and @code{O_CREAT} is also specified, the
@code{open} call will fail. 

@item O_APPEND

The file pointer is positioned at the end of the file before each write. 

@item O_TEXT

The file is opened in text mode, meaning that Ctrl-M characters are
stripped on reading and added on writing as needed.  The default mode is
specified by the @code{_fmode} variable @xref{_fmode}. 

@item O_BINARY

The file is opened in binary mode.

@end table

If the file is created by this call, it will be given the read/write
permissions specified by @var{permissions}, which may be any combination
of these values:

@table @code

@item S_IREAD

The file is readable.  This is always true for MS-DOS

@item S_IWRITE

The file is writable.

@end table

@subheading Return Value

If successful, the file descriptor is returned.  On error, a negative
number is returned and @code{errno} is set to indicate the error. 

@subheading Example

@example
int q = open("/tmp/foo.dat", O_RDONLY|O_BINARY);
@end example

@c ----------------------------------------------------------------------
@node opendir, file system
@heading @code{opendir}
@subheading Syntax

@example
#include <dirent.h>

DIR *opendir(char *name);
@end example

@subheading Description

This function "opens" a directory so that you can read the list of file
names in it.  The pointer returned must be passed to @code{closedir}
when you are done with it.  @xref{readdir}.

@subheading Return Value

The open directory structure, or @code{NULL} on error.

@subheading Example

@example
DIR *d = opendir(".");
closedir(d);
@end example

@c ----------------------------------------------------------------------
@node optarg, misc
@heading @code{optarg}

@subheading Description

@xref{getopt}

@c ----------------------------------------------------------------------
@node opterr, misc
@heading @code{opterr}

@subheading Description

@xref{getopt}

@c ----------------------------------------------------------------------
@node optind, misc
@heading @code{optind}

@subheading Description

@xref{getopt}

@c ----------------------------------------------------------------------
@node optopt, misc
@heading @code{optopt}

@subheading Description

@xref{getopt}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -