Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/r/readblock.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/r/readblock.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/r/readblock.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/r/readblock.html on line 8
Read blocks of data from a file
#include <unistd.h>
int readblock( int fd,
size_t blksize,
unsigned block,
int numblks,
void *buff );
- fd
- The file descriptor for the file you want to read from.
- blksize
- The number of bytes in each block of data.
- block
- The block number from which to start reading.
- numblks
- The number of blocks to read.
- buff
- A pointer to a buffer where the function can store the data that it
reads.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The readblock() function reads numblks blocks of data
from the file associated with the open file descriptor fd,
into the buffer pointed to by buff, starting at block number
block (blocks are numbered starting at 0).
The blksize argument specifies the size of a block, in bytes.
This function is useful for direct access to raw blocks on a
block special device (for example, raw disk blocks) but may also be used for
high-speed access to database files, for example. (The speed gain is
through the combined seek/read implicit in this call, and the ability
to transfer more than the read() function's limit of
INT_MAX bytes at a time.)
If numblks is zero, readblock() returns zero and has
no other results.
On successful completion, readblock() returns the number of
blocks actually read and placed in the buffer. This number is never
greater than numblks. The value returned may be less than
numblks if one of the following occurs:
- The number of blocks left before the end-of-file is less than
numblks.
- The process requests more blocks than implementation limits allow to be
read in a single atomic operation.
- A read error occurred after reading at least one block.
If a read error occurs on the first block, readblock() returns
-1 and sets errno to EIO.
The number of blocks actually read. If an error occurs, it returns
-1, sets
errno
to indicate the error, and the
contents of the buffer pointer to by buff are left unchanged.
- EBADF
- The fd argument isn't a valid file descriptor open for
reading a block-oriented device.
- EIO
- A physical read error occurred on the first block.
- EINVAL
- The starting position is invalid (0 or negative) or beyond the end of
the disk.
QNX Neutrino
Safety: | |
Cancellation point |
Yes |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
writeblock()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/r/readblock.html on line 190
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/r/readblock.html on line 190