[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


read

Read from a file stream that has been opened in binary mode for unformatted Input/Output.

Compatibility:

This function is compatible with the following targets:

ANSI

BeOS

EMB/RTOS

Mac OS

Palm OS

Win32


Prototype:
#include <unistd.h>
int read(int fildes, char *buf, int count);
Parameters:

Parameters for this facility are:

fildes  
int  
The file descriptor  
buf  
char *  
A buffer to store the data read  
count  
int  
The maximum size in bytes to read  

Remarks:

The function read() copies the number of bytes specified by the count argument, from the file to the character buffer. File reading begins at the current position. The position moves to the end of the read position when the operation is completed.


NOTE

This function should be used in conjunction with unistd.h:write(), and fcntl.h:open() only.
Return:

read() returns the number of bytes actually read from the file. In case of an error a value of negative one is returned and errno is set.

See Also:

"fread"

"open"

For example of read() usage:
Refer to "Example of close() usage.".


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 16, 2000