delorie.com/djgpp/doc/libc/libc_642.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

read

Syntax

 
#include <unistd.h>

ssize_t read(int fd, void *buffer, size_t length);

Description

This function reads at most length bytes from file fd into 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, read will read exactly zero bytes.

Directories cannot be read using read -- use readdir instead.

Return Value

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

Portability

ANSI/ISO C No
POSIX 1003.2-1992; 1003.1-2001

Example

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


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004