Lely core libraries  2.2.5
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 
27 enum {
29  IO_FILE_READ = 1 << 0,
31  IO_FILE_WRITE = 1 << 1,
33  IO_FILE_APPEND = 1 << 2,
35  IO_FILE_CREATE = 1 << 3,
40  IO_FILE_NO_EXIST = 1 << 4,
43 };
44 
45 enum {
52 };
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
69 io_handle_t io_open_file(const char *path, int flags);
70 
85 io_off_t io_seek(io_handle_t handle, io_off_t offset, int whence);
86 
99 ssize_t io_pread(io_handle_t handle, void *buf, size_t nbytes, io_off_t offset);
100 
113 ssize_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_
This is the public header file of the I/O library.
Open a file for reading.
Definition: file.h:29
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:198
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:181
Append data to the end of the file.
Definition: file.h:33
A seek operation with respect to the current offset in a file.
Definition: file.h:49
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:215
Create a new file if it does not exists.
Definition: file.h:35
Open a file for writing.
Definition: file.h:31
Truncate an existing file (ignored if IO_FILE_NO_EXIST is set).
Definition: file.h:42
Fail if the file already exists (ignored unless IO_FILE_CREATE is set).
Definition: file.h:40
A seek operation with respect to the beginning of a file.
Definition: file.h:47
A seek operation with respect to the end of a file.
Definition: file.h:51
int64_t io_off_t
A file offset type.
Definition: io.h:37
io_handle_t io_open_file(const char *path, int flags)
Opens a regular file.
Definition: file.c:77
An I/O device handle.
Definition: handle.h:41