Lely core libraries
2.3.4
|
Go to the source code of this file.
Data Structures | |
struct | file |
A regular file handle. More... | |
Functions | |
io_handle_t | io_open_file (const char *path, int flags) |
Opens a regular file. More... | |
io_off_t | io_seek (io_handle_t handle, io_off_t offset, int whence) |
Moves the current read/write offset of an open file. More... | |
ssize_t | io_pread (io_handle_t handle, void *buf, size_t nbytes, io_off_t offset) |
Performs a read operation at the specified offset, without updating the file pointer. More... | |
ssize_t | io_pwrite (io_handle_t handle, const void *buf, size_t nbytes, io_off_t offset) |
Performs a write operation at the specified offset, without updating the file pointer. More... | |
This file is part of the I/O library; it contains the implementation of the regular file functions.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file file.c.
io_handle_t io_open_file | ( | const char * | path, |
int | flags | ||
) |
Opens a regular file.
path | the path name of the file. |
flags | any combination of IO_FILE_READ, IO_FILE_WRITE, IO_FILE_APPEND, IO_FILE_CREATE, IO_FILE_NO_EXIST and IO_FILE_TRUNCATE. |
io_off_t io_seek | ( | io_handle_t | handle, |
io_off_t | offset, | ||
int | whence | ||
) |
Moves the current read/write offset of an open file.
handle | a valid file device handle. |
offset | the desired offset (in bytes) with respect to the beginning of the file (if whence == IO_SEEK_BEGIN ), the current offset (if whence == IO_SEEK_CURRENT ) or the end of the file (if whence == IO_SEEK_END ). |
whence | one of IO_SEEK_BEGIN, IO_SEEK_CURRENT or IO_SEEK_END. |
ssize_t io_pread | ( | io_handle_t | handle, |
void * | buf, | ||
size_t | nbytes, | ||
io_off_t | offset | ||
) |
Performs a read operation at the specified offset, without updating the file pointer.
handle | a valid file device handle. |
buf | a pointer to the destination buffer. |
nbytes | the number of bytes to read. |
offset | the offset (in bytes) at which to start reading. |
ssize_t io_pwrite | ( | io_handle_t | handle, |
const void * | buf, | ||
size_t | nbytes, | ||
io_off_t | offset | ||
) |
Performs a write operation at the specified offset, without updating the file pointer.
handle | a valid file device handle. |
buf | a pointer to the source buffer. |
nbytes | the number of bytes to write. |
offset | the offset (in bytes) at which to start writing. |