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

📄 re

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

@example
#include <osfcn.h>

int read(int fd, void *buffer, unsigned length);
@end example

@subheading Description

This function reads at most @var{length} bytes from file @var{fd} into
@var{buffer}.  Note that in some cases, such as end-of-file conditions
and text files, it may read less than the requested number of bytes. 
At end-of-file, @code{read} will read exactly zero bytes.

@subheading Return Value

The number of bytes read, zero meaning end-of-file, or -1 for an error. 

@subheading Example

@example
char buf[10];
int r = read(0, buf, 10);
@end example

@c ----------------------------------------------------------------------
@node readcr, io
@heading @code{readcr}
@subheading Syntax

@example
int readcr(int fd, char *buf, unsigned length);
@end example

@subheading Description

This is just like @code{read}, but Ctrl-M characters are stripped from
the input.  This function often returns a number less than @var{length}
due to the dropping of characters. 

@subheading Return Value

The number of characters read. 

@subheading Example

@example
char buf[100];
int r = readcr(0, buf, 100);
@end example

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

@example
#include <dirent.h>

struct dirent *readdir(DIR *dir);
@end example

@subheading Description

This function reads entries from a directory opened by @code{opendir}
(@pxref{opendir}).  It returns the information in a static buffer with
this format:

@example
struct dirent @{
  unsigned short d_namlen;  /* The length of the name (like strlen) */
  char d_name[MAXNAMLEN+1]; /* The name */
@};
@end example

@subheading Return Value

A pointer to a static buffer that is overridden with each call.

@subheading Example

@example
DIR *d = opendir(".");
struct dirent *de;
while (de = readdir(d))
  puts(de->d_name);
closedir(d);
@end example

@c ----------------------------------------------------------------------
@node readv, io
@heading @code{readv}
@subheading Syntax

@example
#include <sys/uio.h>

int readv(int handle, struct iovec *iov, int count);
@end example

@subheading Description

This function is like @code{read}, but is able to supply a list of
buffers to read into.  @var{iov} is a pointer to an array of @var{count}
buffer definition structures of this format:

@example
struct iovec @{
  void *iov_base;
  unsigned long iov_len;
@};
@end example

Characters are read into successive buffers until the requested number
of characters are read or until no more data is available. 

@subheading Return Value

The number of bytes read. 

@c ----------------------------------------------------------------------
@node realloc, memory
@heading @code{realloc}
@subheading Syntax

@example
#include <stdlib.h>

void *realloc(void *ptr, size_t size);
@end example

@subheading Description

This function changes the size of the region pointed to by @var{ptr}. 
If it can, it will reuse the same memory space, but it may have to
allocate a new memory space to satisfy the request.  In either case, it
will return the pointer that you should use to refer to the (possibly
new) memory area.  The pointer passed may be @code{NULL}, in which case
this function acts just like @code{malloc} (@pxref{malloc}). 

@subheading Return Value

A pointer to the memory you should now refer to. 

@subheading Example

@example
if (now+new > max)
@{
  max = now+new;
  p = realloc(p, max);
@}
@end example

@c ----------------------------------------------------------------------
@node realloc_srchlen, memory
@heading @code{realloc_srchlen}
@subheading Syntax

@example
extern int realloc_srchlen;
@end example

@subheading Description

This value controls certain obscure and obsolete side effect of calling
@code{realloc} with an already-free'd pointer.  Best not to use it.

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

@example
#include <stdio.h>

int remove(const char *file);
@end example

@subheading Description

This function removes the named @var{file} from the file system.  Unless
you have an un-erase program, the file and its contents are gone for
good. 

@subheading Return Value

Zero on success, nonzero on failure.

@subheading Example

@example
remove("/tmp/data.tmp");
@end example

@c ----------------------------------------------------------------------
@node remque, misc
@heading @code{remque}
@subheading Syntax

@example
void remque(struct vaxque *elem);
@end example

@subheading Description

Given a queue of elements derived from this structure:

@example
struct vaxque @{
  struct vaxque *vq_next;
  struct vaxque *vq_prev;
@};
@end example

This function removes the given element from the queue.  This function
emulates the VAX @code{remque} opcode.  @xref{insque}

@subheading Return Value

None.

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

@example
#include <stdio.h>

int rename(const char *oldname, const char *newname);
@end example

@subheading Description

This function renames an existing file @var{oldname} to @var{newname}. 
Wildcards are not allowed, but the two file names may reflect different
subdirectories on the same file system.

@subheading Return Value

Zero on success, nonzero on failure.

@subheading Example

@example
rename("some.doc", "some.sav");
@end example

@c ----------------------------------------------------------------------
@node rewind, stdio
@heading @code{rewind}
@subheading Syntax

@example
#include <stdio.h>

void rewind(FILE *file);
@end example

@subheading Description

This function repositions the file pointer to the beginning of the file
and clears the error indicator. 

@subheading Return Value

None.

@subheading Example

@example
rewind(stdin);
@end example

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

@example
#include <dirent.h>

void rewinddir(DIR *dir);
@end example

@subheading Description

This function resets the position of the @var{dir} so that the next call
to @code{readdir} (@pxref{readdir}) starts at the beginning again. 

@subheading Return Value

None.

@subheading Example

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

⌨️ 快捷键说明

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