Lely core libraries 2.3.4
file.h
Go to the documentation of this file.
1
22#ifndef LELY_IO_FILE_H_
23#define LELY_IO_FILE_H_
24
25#include <lely/io/io.h>
26
27enum {
29 IO_FILE_READ = 1 << 0,
31 IO_FILE_WRITE = 1 << 1,
42 IO_FILE_TRUNCATE = 1 << 5
43};
44
45enum {
52};
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
69io_handle_t io_open_file(const char *path, int flags);
70
85io_off_t io_seek(io_handle_t handle, io_off_t offset, int whence);
86
99ssize_t io_pread(io_handle_t handle, void *buf, size_t nbytes, io_off_t offset);
100
113ssize_t io_pwrite(io_handle_t handle, const void *buf, size_t nbytes,
114 io_off_t offset);
115
116#ifdef __cplusplus
117}
118#endif
119
120#endif // !LELY_IO_FILE_H_
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.
Definition: file.c:219
@ IO_FILE_READ
Open a file for reading.
Definition: file.h:29
@ IO_FILE_CREATE
Create a new file if it does not exists.
Definition: file.h:35
@ IO_FILE_APPEND
Append data to the end of the file.
Definition: file.h:33
@ IO_FILE_TRUNCATE
Truncate an existing file (ignored if IO_FILE_NO_EXIST is set).
Definition: file.h:42
@ IO_FILE_NO_EXIST
Fail if the file already exists (ignored unless IO_FILE_CREATE is set).
Definition: file.h:40
@ IO_FILE_WRITE
Open a file for writing.
Definition: file.h:31
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.
Definition: file.c:185
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.
Definition: file.c:202
io_handle_t io_open_file(const char *path, int flags)
Opens a regular file.
Definition: file.c:81
@ IO_SEEK_CURRENT
A seek operation with respect to the current offset in a file.
Definition: file.h:49
@ IO_SEEK_BEGIN
A seek operation with respect to the beginning of a file.
Definition: file.h:47
@ IO_SEEK_END
A seek operation with respect to the end of a file.
Definition: file.h:51
This is the public header file of the I/O library.
int64_t io_off_t
A file offset type.
Definition: io.h:37
An I/O device handle.
Definition: handle.h:33