read
int read (int fileHandle, void *buffer, unsigned int numberOfBytes);
Purpose
Reads a block of data from the specified file handle and stores this data in the specified buffer. The file position indicator is advanced by the number of characters successfully read. The function returns the number of bytes successfully read.
![]() |
Note This function is not in the ANSI standard. To use this function, you must include lowlvlio.h in your program or interactive window. |
Parameters
Input | ||
Name | Type | Description |
fileHandle | int | Specifies the file handle from which data is read. |
numberOfBytes | unsigned int | Specifies the number of bytes to be read. If a read error or end-of-file is encountered, the number of bytes actually read can be less than the number specified in this parameter. |
Output | ||
Name | Type | Description |
buffer | void * | Contains the address of a buffer that receives the data read from the specified file handle. |
Return Value
Name | Type | Description |
bytesRead | int | Contains the number of bytes successfully read, excluding any carriage return characters removed. If a read error or end-of-file is encountered, the returned value can be less than that specified in the number_ofBytes parameter. If an error occurs, read returns 0 and sets errno to a nonzero value. |
Additional Information
Library: ANSI C Library
Include file: lowlvlio.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later